In message 19991211124359.A4186@esmeralda.gerwinski.de Peter Gerwinski writes:
David James wrote:
[...] The previous compiler allowed one to write to a text file that had been opened with 'reset' and then 'extend'ed. GPC says:
./daj13: cannot write to read only file `daj13.pas' (error #422)
===== program daj13(input,output);
var f:text;
begin reset(f,'daj13.pas'); extend(f); writeln(f,'extra text'); end.
If you `close' the file before the `extend', it works.
I'm still not sure what my example should do. Looking at the copy of Extended Pascal ISO/TEC 10206:1990(E) that I found on (I think) a DEC site somewhere, I *think* it is saying (in section 6.7.5.2) that after the call to 'extend' the file should be in 'Generation' mode.
I think the run-time error on the 'writeln' is incorrect. However, it is possible that there should be an error on the call to 'extend' (it's not clear to me whether calling 'extend' on a file that has already been 'reset' is allowed).
Do you happen to know what Extended Pascal thinks about how `close' should work?
No, I'm afraid I don't. I cannot find any reference to 'close' in the index of ISO 10206, and I cannot see anything referring to 'close' in section 6.7.5.2 'File Handling procedures'.