_FEOF( ) API Library Routine 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
};