Mail Archives: djgpp/1997/02/10/14:41:27
From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Date: Sun, 09 Feb 1997 01:16:17 GMT
On Sat, 8 Feb 1997 22:31:40 GMT, ethan DOT jacobs AT juno DOT com (Ethan L
Jacobs) wrote:
> I have a book that says fscanf is supposed to return EOF. In
>DJGPP it returns NULL. Is that an error or is it supposed to be there?
I'm not sure what you're referring to here... fscanf returns the
number of items successfully scanned (quote from libc docs) or, which
isn't stated, EOF if it reaches the end of the file.
Note that here NULL==0, so if it returns 0 meaning no items scanned
you could be reading this as a NULL.
From the UNIX man page for fscanf:
Errors
These routines return the number of successfully matched and assigned
input items; this number can be zero in the event of an early
matching failure between an input character and the control string.
If the input ends before the first matching failure or conversion,
EOF is returned.
K&R 2d says the same.
--
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com
A proverb is no proverb to you 'till life has illustrated it. -- John Keats
- Raw text -