Previous: Assert procedure To the Table of Content Next: Assigned function

- 4.62.2.6 -
Standard Units
System Unit
System Unit Procedures and Functions

Assign procedure

Targets: MS-DOS, Win32

System Unit

Assigns the name of an external file to a file variable.

Declaration:
procedure Assign(var F; FileName; String);
Remarks:
After a call to Assign, all file operations on F are associated with FileName. It may consist of a drive and directory specification. If no drive or directory is specified then the current directory is used. If FileName is empty then the standard output defined by operation system is used. Assign should not be used on an open file.

Example:
{$ifndef __CON__}
  This program must be compiled as console application only
{$endif}
var
  FiText:Text;
begin
  Assign(FiText, 'TEXTFILE.TXT');
  Rewrite(FiText);
  WriteLn(FiText, 'TextFile is now written to!');
  Close(FiText);
end.



Previous: Assert procedure To the Table of Content Next: Assigned function
Assert procedure Table of Content Assigned function

- 4.62.2.6 -