[fpc-pascal]File errors
James Mills
prologic at prologitech.com
Mon May 5 14:43:40 CEST 2003
On Mon, May 05, 2003 at 02:25:46PM +0200, Peter Vreman wrote:
> >> On Mon, May 05, 2003 at 01:36:41PM +0200, Marco van de Voort wrote:
> >> > [ Charset ISO-8859-1 unsupported, converting... ]
> >> > > > 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
> >> >
> >> > Can be dangerous in multi tasking and/or multi user system. Also that
> >> > doesn't keep track of e.g. the reserved rootspace on unix.
> >> >
> >> > Best way is to check ioresult after writing each block to see if it is
> >> zero?
> >>
> >> Or use a try except ?
> >
> > Standard fileoperations don't raise exceptions. That is for higher level
> > constructs (like FCL file streams).
> >
> > If basic block I/O would use exceptions, that would make it slow.
>
> basic IO also generates exceptions when SysUtils is used. The normal
> runtime errors will then be mapped to their corresponding exceptions.
Really ? Thank you, That's rather usefull to know. I would then be able
to use exceptions then without any performance penalty dispite what
Peter wrote...
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