Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

_FFlush( ) API Library Routine

Visual Studio .NET 2003

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

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

#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

_FPuts( ) API Library Routine | _FWrite( ) API Library Routine | _FError( ) API Library Routine | Accessing the Visual FoxPro API

© 2015 Microsoft