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

Giuliano Colla giuliano.colla at fastwebnet.it
Thu Nov 1 11:53:27 CET 2012


Il 01/11/2012 11:43, Jonas Maebe ha scritto:
> 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.
>
Which doesn't affect FileOpen behavior.

Giuliano




More information about the fpc-pascal mailing list