Condividi tramite


FFLUSH( ) Function

Flushes to disk a file opened with a low-level function.

FFLUSH(nFileHandle)

Return Values

Logical

Parameters

  • nFileHandle
    Specifies the file handle of the file to flush to disk.

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)
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

See Also

FCHSIZE( ) | FCLOSE( ) | FCREATE( ) | FEOF( ) | FGETS( ) | FOPEN( ) | FPUTS( ) | FREAD( ) | FSEEK( ) | FWRITE( )