[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'System' (#rtl)

Reset

Open file for reading

Declaration

Source position: systemh.inc line 1182

procedure Reset(

  var f: file;

  l: LongInt

);

procedure Reset(

  var f: file

);

procedure Reset(

  var f: TypedFile

);

procedure Reset(

  var t: Text

);

Description

Reset opens a file F for reading. F can be any file type. If F is a text file, or refers to standard I/O (e.g : '') then it is opened read-only, otherwise it is opened using the mode specified in filemode. If F is an untyped file, the record size can be specified in the optional parameter L. A default value of 128 is used. File sharing is not taken into account when calling Reset.

Errors

Depending on the state of the {$I} switch, a runtime error can be generated if there is an error. In the {$I-} state, use IOResult to check for errors.

See also

Rewrite

  

Open file for writing

Assign

  

Assign a name to a file

Close

  

Close a file

Append

  

Open a file in append mode

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.

Documentation generated on: Nov 16 2015