[fpc-pascal]"filesize" Problem/Bug ?

Peter Vreman pfv at cooldown.demon.nl
Sat Dec 23 21:38:40 CET 2000


> Retrieving the file size of a not initialised file 
> blocks access to further files (IOResult returns value 103)
> Compiled with GO32V2 Snapshot [2000/12/21], executed within a
> Win95-DOS-Box
That is normal as you should handle the error first (read: retrieve
IOResult). This is normal tp behaviour.

> 
> this source shows that problem
> 
> {$I-}
> VAR f1,f2:file;
>     fs:longint;
> BEGIN
>   fs:=filesize(f1);

Add here "if ioresult<>0 then;" to clear the error flag

>   assign(f2,'c:\config.sys'); { every other file can be taken, too}
>   reset(f2,1);
>   writeln(IOresult);
>   close(f2);
> END.







More information about the fpc-pascal mailing list