JavaScript Editor js editor     Web development 

Main Page

Flushes to disk all modified buffers in memory for the specified file.

int _FFlush(FCHAN chan)
FCHAN chan;               /* File channel of file to flush. */


_FFlush( ) returns 0 if it is successful in flushing the buffers, or – 1 if it fails.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.


The following example creates a file and sets its length to 8196 bytes. Executing the Visual FoxPro command line DIR TEMP.TXT in the Command window shows that the size of the file on disk is still 0. However, after executing = XFFLUSH(В ), issuing the command line DIR TEMP.TXT shows that the file on disk reflects the _FCHSize(В ) call, and has a file size of 8196 bytes.

Visual FoxPro Code

В Copy Code
DIR temp.txt  && size on disk is still 0
WAIT WINDOW "File Size = 0"
DIR temp.txt  && size on disk is 8196
WAIT WINDOW "File Size Does Not Equal 0"

C Code

В Copy Code
#include <pro_ext.h>

static FCHAN fchan;

FAR CreateIt(ParamBlk FAR *parm)
   fchan = _FCreate("temp.txt", FC_NORMAL);
   _FCHSize(fchan, 8196);

FAR FFlushEx(ParamBlk FAR *parm)

FoxInfo myFoxInfo[] = {
   {"ONLOAD", (FPFI) CreateIt, CALLONLOAD, ""},
   {"XFFLUSH", (FPFI) FFlushEx, 0, ""},
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo

See Also

JavaScript Editor js editor     Web development