[5358] in Athena Bugs

home help back first fref pref prev next nref lref last post

stdio, fread, and ferror man pages

daemon@ATHENA.MIT.EDU (Joe Harrington)
Fri Jun 29 20:05:57 1990

Date: Fri, 29 Jun 90 20:02:37 -0400
From: Joe Harrington <jh@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
Cc: jh@ATHENA.MIT.EDU, cfields@ATHENA.MIT.EDU
Reply-To: jh@ATHENA.MIT.EDU

fread and fwrite are part of stdio.  From stdio man page:

     An integer constant EOF (-1) is returned upon end of file or
     error by integer functions that deal with streams.

Both fread and fwrite return integers.  From fread man page:

     Fread and fwrite return 0 upon end of file or error.

While the behavior of fread and fwrite is correct (to my humble
logic...), the difference should be noted in both man pages.

Also, the fread man page never mentions how to call ferror to
determine which you got, EOF or error, not is it in the see also list,
and none of these man pages (including ferror's) mentions calling
perror() to figure out what the error was!

--jh--

home help back first fref pref prev next nref lref last post