AssignFileBelongs to : Procedure
The AssignFile procedure assigns a value to FileHandle for a FileName in preparation for reading or writing to that file.
Takes a text file variable type as the handle. The file is treated as a textfile when opened.
If the file name is an empty string, then file access is made to the console standard input and output streams.
Takes a binary file variable type as the handle. The file is treated as a binary file.
In both cases, when the file is opened by Append, Reset or ReWrite, it is assumed to be in the current directory.
The FileHandle must no be confused with the file handle used for the low level file handling routines such as FileOpen and FileRead.
myFile : TextFile;
text : string;
// Try to open the Test.txt file for writing to
// Write a couple of well known words to this file
// Close the file
// Reopen the file for reading
// Display the file contents
while not Eof(myFile) do
// Close the file for the last time