View Single Post
  #10   Spotlight this post!  
Unread 06-02-2007, 09:54
buddy.smith buddy.smith is offline
Master Control
FRC #1795
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2007
Location: atlanta
Posts: 20
buddy.smith is an unknown quantity at this point
Re: Robot style EOF?

Okay, to be pedantic:

A char is NOT 8 bits. A char is 8 bits on some (probably most) platforms, but it is not required.

Here are the requirements for data types in C:
A char is some size.
A short is at least as big as a char.
An int is at least as big as a short.
A long is at least as big as an int.

If you say 'a char is 8 bits', please quantify that by saying 'a char is 8 bits on the PIC, and the x86 as well'. Some DSPs have 16 or even 24 bit chars!

As far as EOF, I think we need to figure out what question the original poster really meant to ask. What are you trying to accomplish, that you were thinking you needed to use EOF for?

If it's for reading data from the serial, you use '\n' (or '\r', or both). Whoever said that this will be replaced with -1 is mistaken.

ttyl,

--buddy