On 1 Nov 2003 07:58:03 -0800,
ComputerNerd8888@cox.net (Andrew EMA
Free!) wrote in comp.lang.c++:
[color=blue]
> Well when reading in a file C++ Has no way of telling if it will read
> in a char, int, ect... So it will return in char because this type of
> variable can hold any letter, number, or symbol. So when reading in a
> file read it into a char variable. This is why when you read in the
> file using a char variable it works correctly.
>
> BTW: Many people think that there is really a EOF symbol in a file..
> This is NOT true. C++ Will return -1 when the file is complete read
> in... EOF is a Marco declared in iostream.h for -1.
>
> Andrew[/color]
The C++ standard inherits the macro EOF from the C language standard,
and does not specify or require that the value of this macro be -1,
although that is very common.
The only requirement is that EOF have type int and a value less than
0. It could be any value from -1 through INT_MIN inclusive.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
ftp://snurse-l.org/pub/acllc-c++/faq