"bhanu" <> writes:
> Try this program: EOF is always -1, not any negative number.
[snip]
C99 7.19.1p3, describing the standard header <stdio.h>, says:
The macros are
[...]
EOF
which expands to an integer constant expression, with type int and a
negative value, that is returned by several functions to indicate
end-of-file, that is, no more input from a stream;
[...]
The behavior of the program you posted is consistent with this. An
implementation with EOF==-2 or EOF==-20000 would also be consistent
with the standard.
(I'm assuming that your program correctly demonstrates that EOF==-1
for a given implementation; I haven't actually confirmed this.)
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.