Back to manual index

:: closefile()

:: Type = Filesystem function :: Environment = Windows, Linux, Unix :: What = The closefile procedure closes an open file given by FileHandle. :: Note = The file must have been assigned, and/or opened with append or rewrite function. Example:
program filetest;

var TextOut : text;       { pointer for text file }
var FileOutput : string;  { string to write to text file}

begin

  FileOutput := 'Write this to file. ';

  append(TextOut,'testfile.txt');

  writeln(TextOut,FileOutput,FileOutput);

  closefile(TextOut);

end.
Output: Last line of text file testfile.txt will have Write this to file. Write this to file.