LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-14-2005, 03:48 AM   #1
ecsed
Registered User
 
Registered: Jun 2005
Location: Graz/Austria
Distribution: RedHat Linux
Posts: 11

Rep: Reputation: 0
Angry Is CS8 == 0x0030 or CS8 == 0x0300?


Hy friends,

in termios.h I read: '#define CS8 0000060'

if I code 'printf ("CS8:%04X")' I get 'CS8:0300', WHY?

0000060 should be octal,
0000060 oct should be 0x0030 hex, 0000.0000.0011.0000 bin,
but I get 0x0300 hex, WHY?

Thanks!

Regards
Egon
 
Old 10-14-2005, 03:59 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
I tried (on Debain stable ("sarge")):
Code:
#include <stdio.h>
#include <termios.h>

int main()
{
    printf("CS8:%04X\n", CS8);
    return 0;
}
And it does give me the correct answer:
Code:
bash$ gcc -Wall -pedantic -o cs cs.c
bash$ ./cs
CS8:0030
Do you have an extra '0' in the printf format string?
 
Old 10-14-2005, 04:57 AM   #3
ecsed
Registered User
 
Registered: Jun 2005
Location: Graz/Austria
Distribution: RedHat Linux
Posts: 11

Original Poster
Rep: Reputation: 0
Hy Hko,

for the Linux-host I get CS8:0030, for the MPC885 target I get CS8:0300 as
for the target CS8 is defined as

/opt/Arabella/powerpc-linux/sys-include/bits/termios.h:#define CS8 00001400

and 01400 octal is 0300 hex!!

Thanks my friends.

Best regards
Egon
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration