From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: fread/fwite return value Date: Mon, 28 Jul 1997 10:19:07 -0700 Organization: Alcyone Systems Lines: 19 Message-ID: <33DCD48B.7FCF8736@alcyone.com> References: <199707161515 DOT AA104406147 AT typhoon DOT rose DOT hp DOT com> <33CD1946 DOT 2795 AT cornell DOT edu> NNTP-Posting-Host: newton.alcyone.com 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 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. -- Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com Alcyone Systems / web / http://www.alcyone.com/max/ San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W \ "Love is not love which alters / when it alternation finds." / William Shakespeare, _Sonnets_, 116