Dear friends,
I don't know if what I found is a bug or a correct behaviour I don't understand.
The following program halts with error 'attempt ro read past end of file';
program test; var f : file of char; begin rewrite(f,'test.dat'); seek(f,0); f^:='x'; (*GIVES ERROR HERE*) put(f); close(f); end.
If I just insert a call reading eof(f) everything seems to work:
program test; var f : file of char; begin rewrite(f,'test.dat'); seek(f,0); if eof(f) then ; (* do nothing *) f^:='x'; put(f); close(f); end.
I am puzzled!
(working with gpc 20030830)
Ciao, Francesco