Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Close Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
file_variable Typed, untyped, or text file; already opened
Description
The Close procedure closes the file associated with file_variable.
The file must be open. Open a file with Append, Reset, or Rewrite.
Close ends all operations on the specified file and writes to the
file any data remaining in the file buffer. It then closes the file
and frees the DOS file handle. The file is still associated with
file_variable. The file_variable argument can be reopened on the
same file without reassigning, or can be assigned to a different
external file.
Reset and Rewrite close and reopen an open file, making it
unnecessary to call Close before calling these procedures when a
file is already open.
QuickPascal closes files automatically before a program ends.
If file_variable has not been assigned or if the file is not open,
an I/O error occurs.
To prevent a program from halting with a run-time error when an I/O
error occurs, turn off I/O checking with {$I-} and check the return
value of the IOResult function.