[fpc-pascal]File errors
James Mills
prologic at prologitech.com
Mon May 5 13:45:05 CEST 2003
On Mon, May 05, 2003 at 01:34:15PM +0200, Jilani Khaldi wrote:
> >> 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
Oh right. I forgot FPC had support for exceptions. Afterall it is an OO
Language :P haha
Thank you, try except is probably more what I want.
cheers
James
>
>
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list