AssignFile

Declaration:
Procedure AssignFile(Var f: FileType;Name: Character type);
Description:
AssignFile is completely equivalent to the system unit’s Assign (455) function: It assigns Name to a function of any type (FileType can be Text or a typed or untyped File variable). Name can be a string, a single character or a PChar.

It is most likely introduced to avoid confusion between the regular Assign (455) function and the Assign method of TPersistent in the Delphi VCL.

Errors:
None.
See also:
CloseFile (599), Assign (455), Reset (558), Rewrite (559), Append (452)

Listing: refex/ex88.pp


Program Example88;

{ Program to demonstrate the AssignFile and CloseFile functions. }

{$MODE Delphi}

Var F : text;

begin
  AssignFile(F,'textfile.tmp');
  Rewrite(F);
  Writeln (F,'This is a silly example of AssignFile and CloseFile.');
  CloseFile(F);
end.