is it really necessary for character values to be positive?
mouse at mcgill-vision.UUCP
mouse at mcgill-vision.UUCP
Mon Jan 12 16:15:36 AEST 1987
In article <293 at haddock.UUCP>, karl at haddock.UUCP (Karl Heuer) writes:
> [Your suggestion] supports my contention that making getchar() an int
> function was a mistake in the first place.**
> **I do have what I think is a better idea, but I'm not going to
> describe it in this posting.
How about in another posting then?
What I normally do is something more like
char c; /* yes, char! */
....
c = getc(stream); /* or getchar() if stdin */
if (feof(stream) || ferror(stream))
{ ....
}
ie, *ignore* the EOF return and check explicitly.
Is this better? worse? than the int c; c=getc(stream); if (c==EOF)
approach? Why?
der Mouse
USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse
think!mosart!mcgill-vision!mouse
Europe: mcvax!decvax!utcsri!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!mouse at harvard.harvard.edu
More information about the Comp.lang.c
mailing list