Mail Archives: djgpp/2000/05/11/17:05:17
Hmm...well, after waking up this morning I checked my e-mail and found the
link to the ANSI-C standard (1999). Apparently when I wrote the function
years ago, I saw only the first part of the return:
Returns
3 If the end-of-file indicator for the stream is set, or if the stream is
at end-of-file, the end-of-file indicator for the stream is set and fgetc
returns EOF. Otherwise, the fgetc function returns the next character from
the input stream pointed to by stream. If a read error occurs, the error
indicator for the stream is set and fgetc returns EOF.
The way it sounded according to the description and the return is that gcc
was reading in the character AFTER testing for eof indicator and Borland
was reading in a character, moving ahead one character and THEN testing for
eof.
The way my code was written (I must admit it is ugly...but I never had a
problem before) was to read each character in until it hit a newline or
eof. However, I never ran into any problems because the eof was always
after a newline (due to the way MS-DOS EDIT works). So, when I started
using notepad/vim, the LineInput routine made djgpp hiccup as well as gcc.
However, my tests ran fine under Borland because I was using different test
files created under MS-DOS EDIT.
Today I tested under Borland on the original files and discovered the same
problem (that's how I came to this e-mail).
**** So, I apologize for the angry e-mails I sent last night. ****
Oh, BTW, thanks for the ANSI-C documentation. I've always wondered where I
could get standards like that.
Thomas J. Hruska -- shinelight AT crosswinds DOT net
Shining Light Productions -- "Meeting the needs of fellow programmers"
http://www.shininglightpro.com/
- Raw text -