next up previous contents index
Next: Rewrite Up: Functions and Procedures Previous: Rename

Reset

   

Declaration:

Procedure Reset (Var F : Any File Type[; L : longint]) ;

Description:

Reset opens a file F for reading. F can be any file type. If F is an untyped or typed file, then it is opened for reading and writing. If F is an untyped file, the record size can be specified in the optional parameter L. Default a value of 128 is used.

Errors:

If the file cannot be opened for reading, then a run-time error is generated. This behavior can be changed by the {$i} compiler switch.

See also:

Rewrite, Assign, Close

Example
Program Example51;

{ Program to demonstrate the Reset function. }

Function FileExists (Name : String) : boolean;

Var F : File;

begin
  {$i-}
  Assign (F,Name);
  Reset (F);
  {$I+}
  FileExists:=(IoResult=0) and (Name<>'');
  Close (f);
end;

begin
  If FileExists (Paramstr(1)) then
    Writeln ('File found')
  else
    Writeln ('File NOT found');
end.



Michael Van Canneyt
Thu Sep 10 14:02:43 CEST 1998