Posted May 28, 2009 18:04 UTC (Thu) by ajross (subscriber, #4563)
In reply to: Quotes of the week by elanthis
Parent article: Quotes of the week
That would all be true, except for the fact that stdio is itself specified as allowing short count in arbitrary conditions. The behavior of ISO C's fread/fwrite in this situation is no better, according to the standard, than that of POSIX's read/write.
Obviously sane C libraries don't return short counts from disk files in practice. But they could (and I'm sure someone will pipe up with a real world example where one does), so you still have to write the loops as a matter of standards compliance.