CFile:FilePos CFile:GetPath

CFile:Flush


The Flush method commits data residing in operating system file buffer to the file attached to the CFile object.

Syntax

bResult = CFile:Flush()

    On success, this method returns true.

    On failure, including end-of-file, this method returns false.

Remarks

The operating system buffers file access so that data are committed to the file only when the buffer becomes full. The Flush method causes the operating system to transfer the buffer contents to the file, regardless of whether the buffer is full.

Example

Suppose a CFile named F exists and the file is open for writing. The script fragment below writes formatted text to the file and then flushes the system file buffer:

 

s = "My string" ; n = 12.553

 

F:Printf("'%s': v=%-12lg\n", s, n ))

-- do a formatted print to the file

F:Flush()

-- makes sure the data are in the file

Related Topics

CFile, Printf