System.Flush

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Flush(var t: Text): Integer;

C++

extern DELPHI_PACKAGE int __fastcall Flush(TextFile &t);

Properties

Type Visibility Source Unit Parent
function public
System.pas
System.hpp
System System

Description

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