Waldek Hebisch wrote:
Tom Schneider wrote:
One of my programs, which I have used with many compilers in the past, started an odd behavior as soon as I compiled with GPC. I rooted down to what the cause was and found this:
EOF is not true on a reset empty file.
<snip> > Is this standard behavior for Pascal? I thought that if you reset > an file, it would be at eof. Where else could it be?
There is a little tricky point here: the standard requires read from text file to give eoln and a space character before eof. So GPC runtime adds a newline before eof if original file contained no newline. That was wrong for empty file.
Indeed (it's really tricky ...).
The following patch should fix the problem (apply it relatively to gpc-20041218/p directory):
Yes, thanks. (tom7.pas)
Frank