[fpc-pascal]filesize

Adam Naumowicz adamn at math.uwb.edu.pl
Wed Jul 24 15:48:08 CEST 2002


On Wed, 24 Jul 2002, Jonas Maebe wrote:

> On Wed, 24 Jul 2002, Adam Naumowicz wrote:
>
> > Thanks, I was misled as the error was caused by an operation on the file
> > (FileSize in this situation) which shouldn't do any attempt to write to
> > a file. That's why I expected it would not raise errors no matter in
> > what mode the file was reset.
>
> Strange, when I just tested it, the error was caused by reset.

That is really strange :-)
On my system the prog below runs without errors.

program tester;

var f:file of char;

begin
   filemode:=0;
   assign(f,'/etc/passwd');
   reset(f);
//   writeln(FileSize(f));
   close(f);
end.

GDB located the error at FileSize, so that was while I said so.
Therefore my question is still valid - should a call to a routine as
FileSize or Read cause an error when a FileMode is default ?
I checked that the same test program doesn't complain when compiled
with GPC, with Kylix error #13 is raised.

Regards,
Adam Naumowicz

--------------------------------------
WWW: http://math.uwb.edu.pl/~adamn/
--------------------------------------





More information about the fpc-pascal mailing list