Previous: 4.67.2.5. Assert procedure To the Table of Contents Next: 4.67.2.7. Assigned function
4.67.2.5. Assert procedure Table of Contents 4.67.2.7. Assigned function

- 4.67.2.6. -
Table of Contents
4. Standard Units
4.67. System - Built-in routines
4.67.2. System Unit Procedures and Functions
4.67.2.6. Assign procedure


4.67.2.6. 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: 4.67.2.5. Assert procedure To the Table of Contents Next: 4.67.2.7. Assigned function
4.67.2.5. Assert procedure Table of Contents 4.67.2.7. Assigned function

- 4.67.2.6. -