[fpc-pascal]File errors
James Mills
prologic at prologitech.com
Mon May 5 12:11:32 CEST 2003
On Mon, May 05, 2003 at 11:52:46AM +0200, Peter Vreman wrote:
> > On Mon, May 05, 2003 at 11:35:14AM +0200, Peter Vreman wrote:
> >> > Hi,
> >> >
> >> > How do you check for file errors such as "Disk Full" before attempting
> >> > to write out a file to disk ?
> >> > You can easily check if a file exists with the fileExists function...
> >> > Can something similar be done for other file errors ?
> >>
> >> You can check with diskfree() how much space is left on a disk
> >
> > Well the program I'm developing is irc services, any particular way
> > you'd reccomend recoding it so it doesn't crash because of a 'Disk Full'
> > error ?
>
> 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).
The program I've been developing obviously have to be 100% stable :)
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