www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/14/18:01:27

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: fin problem with djgpp
Date: Mon, 14 Sep 1998 18:26:42 -0300
Organization: NBTel Internet
Lines: 22
Message-ID: <35FD8A12.AEA3AFCC@unb.ca>
References: <35FC5C55 DOT E6A2570D AT us DOT oracle DOT com>
NNTP-Posting-Host: fctnts13c75.nbnet.nb.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Arnold K. Poon wrote:
>     The program is suppose to read each line and print that out.
> However, when I use DJGPP to compile, I got an extra line of output. The
> EOF variable was NOT set to ZERO after reading file, therefore the while
> loop enters 1 more time and print out some bogus output.
> 
>     However, if i compile with MSVC++5.0 (default workspace), I did not
> get this problem.
> 
>     Am I using EOF correctly? or is there something different between
> MSVC and DJGPP compiler?
	EOF is not set to true until an attempt to retreive a variable FAILS.  This
does not happen until AFTER the last line is entered.  If you changed it to
say "file.peek()!=EOF", then that will likely work.

-- 
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT GeoCities DOT com
          Endlis AT nbnet DOT nb DOT ca


- Raw text -


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