Close¶
Close a file.
Declaration¶
Source position: systemh.inc line 1453
procedure Close(var f: File);
procedure Close(var t: Text);
Errors¶
Depending on the state of the {$I} switch, a runtime error can be generated if there is an error. In the {$I-} state, use IOResult to check for errors.
See also¶
| Name | Description |
|---|---|
| Assign | Assign a name to a file. |
| Reset | Open file for reading. |
| Rewrite | Open file for writing. |
| Flush | Write file buffers to disk. |
Example¶
Program Example9;
{ Program to demonstrate the Close function. }
Var F : text;
begin
Assign (f,'Test.txt');
ReWrite (F);
Writeln (F,'Some text written to Test.txt');
close (f); { Flushes contents of buffer to disk,
closes the file. Omitting this may
cause data NOT to be written to disk.}
end.