4.2bsd eof flag in stdio

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Tue Dec 11 15:23:08 AEST 1984


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

Yes, it used to say that.  It failed to clarify what would happen on
a "short read".  Returning 0 in such a case is absolutely incompatible
with the DESIGN of fread(): that you tell it how many items you want
and it returns the number you got.  Clearly the above portion of the
manual was not well thought out, since it led to this discussion.
AT&T has clarified this (and many similar oversights, ambiguities, and
confusion) in the manual; and in this particular case I think they did
it right (since it makes the function design make more sense than the
other interpretation).



More information about the Comp.unix.wizards mailing list