FFLUSH( ) Function
Flushes to disk a file opened with a low-level function.
FFLUSH(nFileHandle [, lForce])
Return Value
Logical
Parameters
nFileHandle
Specifies the file handle of the file to flush to disk.lForce
If you specify a logical true (.T.) for lForce, Windows is used to immediately flush the file to disk.If you specify a logical false (.F.) (the default if lForce is omitted), Visual FoxPro flushes the file to disk at its earliest opportunity.
Remarks
FFLUSH( ) also releases the memory used by the file's buffer.
FLUSH is different from the FFLUSH( ) function. FLUSH doesn't operate on low-level files but rather on tables and indexes.
Example
The following example opens and writes to a file named Input.dat. After writing the first two strings, the program flushes the buffers to ensure that the strings are written to disk. It then writes the next two strings, flushes the buffers again and closes the file.
IF FILE('input.dat')
gnTestFile = FOPEN('input.dat',2)
ELSE
gnTestFile = FCREATE('input.dat')
ENDIF
gnIOBytes = FWRITE(gnTestFile,'Test output')
gnIOBytes = FWRITE(gnTestFile,' for low-level file I/O')
glFlushOk = FFLUSH(gnTestFile, .T.)
gnIOBytes = FWRITE(gnTestFile,'Test output2')
gnIOBytes = FWRITE(gnTestFile,' for low-level file I/O')
glFlushOk = FFLUSH(gnTestFile)
glCloseOk = FCLOSE(gnTestFile)
MODIFY FILE input.dat NOWAIT NOEDIT