From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp,comp.lang.c++ Subject: Re: Reading binary files Date: Fri, 13 Jun 1997 10:13:51 -0400 Organization: Cornell University http://www.cornell.edu Lines: 26 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <33A1559F.7F98@cornell.edu> References: <33a13a3a DOT 2140316 AT supernews DOT scsn DOT net> Reply-To: asu1 AT cornell DOT edu NNTP-Posting-Host: cu-dialup-0050.cit.cornell.edu 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 Chris wrote: > > When reading in binary files, I need to know how to stop when reaching > the EOF. > this is waht the ANSI specs say about fread: "The fread function returns the number of elements successfully read, which may be less than nmemb if a read error or EOF is encountered. If size or nmemb is zero, than the contents of the array and the state of the stream remain unchanged." Use this information and the standard ferror function. i would also recommend reading the C FAQ and posting basic C questions to comp.lang.c or comp.lang.c.moderated. -- Sinan ******************************************************************* A. Sinan Unur WWWWWW |--O+O mailto:sinan DOT unur AT cornell DOT edu C ^ http://www.people.cornell.edu/pages/asu1/ \ ~/ Unsolicited e-mail is _not_ welcome, and will be billed for. *******************************************************************