[fpc-pascal] Why opening a file for write fails in fpc 2.6?

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Nov 1 11:43:34 CET 2012

On 01 Nov 2012, at 11:40, Giuliano Colla wrote:

> You may be right, but the try-except construct is there exactly to permit you to handle those situations.
> However I'd like to point out a significant inconsistency. Please give a look to the following piece of code:
> procedure TForm1.Button1Click(Sender: TObject);
> var
>  MyFile: TextFile;
>  AName: String;
> begin
>  AName:= 'BadName.txt';
>  AssignFile(MyFile,AName);
>  Reset(MyFile);  <==== Raises an Exception: EInOutError File not found
> end;

That depends on the state of the {$i+/-} directive.


More information about the fpc-pascal mailing list