Message-Id: <3.0.6.32.20000511021045.007af4a0@pop.crosswinds.net> X-Sender: shinelight AT pop DOT crosswinds DOT net X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32) Date: Thu, 11 May 2000 02:10:45 -0500 To: djgpp AT delorie DOT com From: "Thomas J. Hruska" Subject: Re: feof(FILE *) NOT portable... In-Reply-To: <391A44C5.BA4BBCCC@mtu-net.ru> References: <8empao$5k6$1 AT nnrp02 DOT primenet DOT com> <390ef9f9$0$72098 AT SSP1NO17 DOT highway DOT telekom DOT at> <8emvhq$7mn$1 AT nnrp03 DOT primenet DOT com> <3 DOT 0 DOT 6 DOT 32 DOT 20000505015633 DOT 007b2210 AT pop DOT crosswinds DOT net> <3 DOT 0 DOT 6 DOT 32 DOT 20000510204858 DOT 007b6e40 AT pop DOT crosswinds DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk At 09:27 AM 5/11/00 +0400, you wrote: >I think the Borland C compiler you use has a bit buggy LIBC. > >In fact, you must try to read one character from the file in order to >determinde EOF. Just read help from BC: >--------------------8<----------------------- >Return Value: > _ Returns non-zero if an end-of-file > indicator was detected on the last input > operation on the named stream. > _ Returns 0 if end-of-file has not been > reached. >--------------------8<----------------------- > >*Last input operation* means you must invoke feof() after fgetc() or >something like that. > >Btw, you may forget about feof() almost at all if you use fgetc(). That's >because fgetc() returns an integer value (not a single-byte character). And >the return value is -1 when you try to read past the end of the file. > >Good Luck >Alexei A. Frounze >----------------------------------------- >Homepage: http://alexfru.chat.ru >Mirror: http://members.xoom.com/alexfru Actually, I have tested this code with both Borland's Turbo C v3.0 for DOS as well as the latest Borland C++ Builder free command-line tools. The exact same results tell be that over many generations of compilers (with thousands and thousands of builds of the libraries and executables), either Borland hasn't noticed a non-ANSI standard with feof, or they are following the standard. My aim is to prove which one doesn't follow the ANSI standard: gcc and all ports of it, or Borland. So, to begin my proof, I went onto the manpages for Linux (on feof) and discovered that the manpages claim to be following the specifications in "C3.159-1989" I have searched both ANSI.org and NSSN.org as well as regular web search engines for this particular document. However, I am unable to find this document or anything newer. The only thing that kept coming up was listings of online manpages that made the same reference to this document that I can't find. If anyone can point me to this document online (or even offline), I would greatly appreciate it. Thomas J. Hruska -- shinelight AT crosswinds DOT net Shining Light Productions -- "Meeting the needs of fellow programmers" http://www.shininglightpro.com/