From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: fread/fwite return value Date: Tue, 29 Jul 1997 09:43:06 -0400 Organization: Cornell University Lines: 17 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <33DDF36A.2039@cornell.edu> References: <199707161515 DOT AA104406147 AT typhoon DOT rose DOT hp DOT com> <33CD1946 DOT 2795 AT cornell DOT edu> <33DCD48B DOT 7FCF8736 AT alcyone DOT com> NNTP-Posting-Host: 128 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Erik Max Francis wrote: > > A. Sinan Unur wrote: > > > that is at best worthless advice. the documentation in this case is > > plain wrong. it is a small mistake, but fread is supposed to return 0 in > > case of error. > > Actually, fread (and fwrite) return the number of elements actually read > (or written) -- an error condition is if this number is less than the > number of elements you passed in. Returning zero means _none_ of the > elements got read (or written), but there are more failure cases than just > that. please guys, let it go. i corrected my stupid mistake several times after that post. -- Sinan