This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

short fread(), but no ferror/feof


I've discovered that fread(ptr, size, nitems, stream) sometimes returns a
value less than "nitems", but does not set feof() nor ferror(). As I
understand, this is incorrect: All fread() documentation I've found
confirms this. For example, IEEE Std 1003.1 says:

"Upon successful completion, fread() shall return the number of elements
successfully read which is less than nitems only if a read error or
end-of-file is encountered."

I've only noticed the problem when using fread() on a pipe, and when
setting a (another) file descriptor in the same application in
close-on-exec mode. The details are on http://python.org/sf/1071516. I've
been using the latest Cygwin (as of 2004-12-04) on Windows 98.

To me, this looks like a Cygwin bug. Any ideas?

/Peter Åstrand <astrand@lysator.liu.se>


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]