[fpc-pascal]File errors

Jilani Khaldi jilani.khaldi at tin.it
Mon May 5 13:34:15 CEST 2003


>> You can turn of io-checking and check the result of ioresult
>> 
>> {$I-}
>>  writeln(flog,logmessage)
>> {$I+}
>> if ioresult<>0 then
>>  writeln(stderr,'Error writing to disk');
>
>Is this considered good programming practise ? Reason I ask is that I
>used to use borland's turbo pascal years ago and am aware of ioresult
>but am interested in how people before me have done it (eg: on linux
>systems).
You can use exceptions:
...
try
  writeln(flog,logmessage)
except
  if sometheng goes wrong :(
end;
...

jk







More information about the fpc-pascal mailing list