Close
Jump to navigation
Jump to search
Closes an open file.
- Declaration
- procedure Close(var F);
- Target
- Windows, Real, Protected
- 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 DOS file handle for reuse.
- With {$I-}, IOResult returns zero if the operation was successful. Otherwise, it returns a nonzero error code.
Sample Code
{Close.PAS} {Sample code for the Close procedure.} var F: file; begin Assign(F, '\AUTOEXEC.BAT'); { open file } Reset(F, 1); Writeln('File size = ', FileSize(F)); Close(F); { Close file } end.