[fpc-pascal]filesize

Martyn Ranyard ranyardm at lineone.net
Wed Jul 24 15:47:20 CEST 2002


Aha - you will find that the same is true under DOS where the file is marked 
read-only.

To open a file for read-only access, you need to set FileMode (to I believe 
0, but it's been a long time), as reset by default opens read-write.

Martyn

On Wednesday 24 July 2002 13:14, Adam Naumowicz wrote:
> Hello,
>
> I've just found out, to my horror, that a tiny program like here:
>
> program tester;
>
> 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)?
>
> Best regards,
> Adam Naumowicz
>
> --------------------------------------
> WWW: http://math.uwb.edu.pl/~adamn/
> --------------------------------------
>
>
> _______________________________________________
> 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