- 4.67.2.13. -
Table of Contents
4. Standard Units
4.67. System - Built-in routines
4.67.2. System Unit Procedures and Functions
4.67.2.13. Close procedure
4.67.2.13. Close procedure
Targets: MS-DOS, OS/2, Win32
System Unit
Closes an open file.
Declaration:
procedure Close(var F);
Remarks:
F is a file variable of any file type previously opened with
Reset, ReWrite
or Append. The external file associated
with F is completely updated and then closed, freeing its file
handle for reuse.
With {$I-}, IOResult returns zero
if the operation was successful; otherwise, it returns a nonzero error code.
Example:
var
Fi: Text;
begin
Assign(Fi, 'C:\DATAFILE.DOC');
ReWrite(Fi);
WriteLn(Fi, 'A New File.');
Close(Fi); // Close and flush buffer to disk
end.
See also:
Assign
{$I} - I/O Checking Switch
- 4.67.2.13. -