delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/18/12:23:10

Date: Fri, 18 Jul 1997 09:20:28 -0700 (PDT)
Message-Id: <199707181620.JAA02352@adit.ap.net>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: fread/fwite return value

A. Sinan Unur wrote:
>heretic AT polbox DOT com wrote:
>> So, I wanted to have error checking and I wrote something like
>> 
>>  if ( fread(blah,blah,blah) == -1 )
>>  {
>>     oh_no_error ();
>>  }
>> 
>
>i think it is an error in the docs. AFAIK, fread is supposed to return
>0, not EOF, precisely because the return value is size_t, and 0
>signifies no bytes read.

Well, AFAIK, fread is an ANSI function, so the standard should be able to
bring enlightenment. Can someone with a copy help us out here?

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019