Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2000-12

"filesize" Problem/Bug ?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Knapp

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

this source shows that problem

{$I-}
VAR f1,f2:file;
    fs:longint;
BEGIN
  fs:=filesize(f1);
  assign(f2,'c:\config.sys'); { every other file can be taken, too}
  reset(f2,1);
  writeln(IOresult);
  close(f2);
END.

Michael

+--------------------------------------------------------------------+ | Michael Knapp - Mauerbach - Niederösterreich - Austria - Europe | | E-Mail: ICQ: 36542787 | +--------------------------------------------------------------------+ | G r a p h i X http://programmierer.freepage.de/graphix/ | | Graphics Library for Freepascal, Virtual Pascal and Borland Pascal | | http://graphix4pascal.cjb.net/ http://www.graphix4pascal.de.vu/ | +--------------------------------------------------------------------+

Reply by email

Peter Vreman
to Michael Knapp
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.

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

Add here "if ioresult0 then;" to clear the error flag

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

Reply by email

Michael Knapp
to Peter Vreman
Peter Vreman wrote 7 lines
> 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.

I seeeeh :-)

Michael

+--------------------------------------------------------------------+ | Michael Knapp - Mauerbach - Niederösterreich - Austria - Europe | | E-Mail: ICQ: 36542787 | +--------------------------------------------------------------------+ | G r a p h i X http://programmierer.freepage.de/graphix/ | | Graphics Library for Freepascal, Virtual Pascal and Borland Pascal | | http://graphix4pascal.cjb.net/ http://www.graphix4pascal.de.vu/ | +--------------------------------------------------------------------+

Reply by email