[fpc-pascal]filesize

Jonas Maebe jonas at zeus.rug.ac.be
Wed Jul 24 14:51:36 CEST 2002


On Wed, 24 Jul 2002, Adam Naumowicz wrote:

> var f:file of char;
>
> begin
>    assign(f,'testfile');
>    reset(f);
>    writeln(FileSize(f));
>    close(f);
> end.
>
> raises error #5 (File access denied) on FileSize when the owner of 'testfile'
> is different from the caller but the caller has read permision for it.
> The same appears when I use 1.0.6 [2002/05/23] on Linux and 1.0.6
> [2002/04/29] on Solaris. Is it already reported (and corrected, hopefuly)?

It's been reported a lot of times already (in several variants), but it is
not a bug. Typed and untyped files and are by default always opened in
READ/WRITE mode when using reset (just like in Turbo Pascal) contrary to
text files, which are opened in read-only mode in that case. Look up the
"filemode" variable in the manual for information on how to fix this
problem.


Jonas





More information about the fpc-pascal mailing list