True...
This is a discussion on fgetc and EOF within the C Programming forums, part of the General Programming Boards category; True......
True...
It's probably so you can do this:Why I didn't think of this before, I don't know...Code:if ((i = fgetc(stdin)) < 0) /* error */
Last edited by robwhit; 08-28-2008 at 02:52 PM.
I reasoned that since EOF is negative and the normal return values of fgetc() are non-negative in a range almost definitely smaller than int, there can be no conflict between them. I did not state that to avoid such a conflict, EOF was defined to be negative (though this may indeed have been an intention of whoever designed this part of the standard library).Originally Posted by robwhit
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Oh ok, I see now.
Sorry for the trouble.![]()
Last edited by robwhit; 08-29-2008 at 09:22 AM.