From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function Flush(var t: Text): Integer;


extern DELPHI_PACKAGE int __fastcall Flush(TextFile &t);


Type Visibility Source Unit Parent
function public
System System


Empties the buffer of a text file opened for output.

F is a text file variable.

When a text file is opened for output using Rewrite or Append, Flush empties the file's buffer. This guarantees that all characters written to the file at that time have actually been written to the external file. Flush has no effect on files opened for input.

Flush returns 0 if the operation succeeded. Otherwise, it returns the error code. When compiled using the {$I-} flag, the IOResult method returns this value.

Note: {$I+} handles run-time errors using exceptions. When using {$I-}, use IOResult to check for I/O errors.

See Also

Code Examples