_FEOF( ) API Library Routine

int _FEOF(FCHAN chan)
FCHAN chan;               /* File channel of file. */

Remarks

_FEOF( ) returns True (an integer other than 0) if the file pointer in the specified file is currently at the end of the file; or False (0) if not.

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

Example

The following example creates a file and sets its length to 8192 bytes. Then it moves the file pointer to the beginning of the file and calls _FEOF( ), which returns 0 (False). Next, it moves the file pointer to the end of the file and again calls _FEOF( ), which this time returns 1 (True).

Visual FoxPro Code

SET LIBRARY TO FEOF  

C Code

#include <pro_ext.h>

void putLong(long n)
{
   Value val;

   val.ev_type = 'I';
   val.ev_long = n;
   val.ev_width = 10;

    PutValue(&val);
}

FAR Example(ParamBlk FAR *parm)
{
   FCHAN fchan =  FCreate("temp.txt", FC NORMAL);
    FCHSize(fchan, 8196);
    FFlush(fchan);

    FSeek(fchan, 0, FS FROMBOF);
    PutStr("\n FSeek(fchan, 0, FS FROMBOF)");
    PutStr("\n FEOF(fchan) ="); putLong(_FEOF(fchan));

   _FSeek(fchan, 0, FS_FROMEOF);
   _PutStr("\n_FSeek(fchan, 0, FS_FROMEOF)");
   _PutStr("\n_FEOF(fchan) ="); putLong(_FEOF(fchan));
}

FoxInfo myFoxInfo[] = {
   {"FEOF", (FPFI) Example, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

_FSeek( ) API Library Routine | _FCopy( ) API Library Routine |_FWrite( ) API Library Routine | Accessing the Visual FoxPro API