Assigns the name of an external file to a file variable.
procedure Assign(var f; String);
Windows, Real, Protected
F is a file variable of any file type, and String is a string-type expression or an expression of type PChar if extended syntax is enabled. All further operations on F operate on the external file with the file name Name.
After a call to Assign, the association between F and the external file continues to exist until another Assign is done on F.
A file name consists of a path of zero or more directory names separated by backslashes, followed by the actual file name:
If the path begins with a backslash, it starts in the root directory; otherwise, it starts in the current directory.
Drive is a disk drive identifier (A-Z). If Drive and the colon are omitted, the default drive is used. \DirName\...\DirName is the root directory and subdirectory path to the file name. FileName consists of a name of up to eight characters, optionally followed by a period and an extension of up to three characters. The maximum length of the entire file name is 79 characters.
A special case arises when String is an empty string; that is, when Length (Name) is zero. In that case, F becomes associated with the standard input or standard output file. These special files allow a program to utilize the I/O redirection feature of the DOS operating system.
If assigned an empty name, after a call to Reset (F), F refers to the standard input file, and after a call to Rewrite (F), F refers to the standard output file.
Cannot be used on an open file.