is struct stat buf.st_size always correct?

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Apr 13 15:28:42 AEST 1990


In article <7751 at jpl-devvax.JPL.NASA.GOV> lwall at jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
>Why use fread?  Why not a normal open and a normal read?  It would be
>less overhead.  On many systems (though not 4.0.3, I think), this has to
>yank the file a piece at a time through the stdio buffers.

However, if you use read(), you should write the code to loop on the
read() for the as-yet unread portion of the file until you get it all
or a 0 is returned.  fread() takes care of this for you.



More information about the Comp.unix.questions mailing list