_FWrite( ) API Library Routine Example

The following example creates a test file and writes some data to it using _FWrite( ).

Visual FoxPro Code

SET LIBRARY TO FWRITE  

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
{
   FCHAN fchan;

   fchan = _FCreate("temp.tmp", FC_NORMAL);
   _FWrite(fchan, "Hello, world.", _StrLen("Hello, world."));
   _FWrite(fchan, "\xd\xa", 2);
   _FWrite(fchan, "1234567890", 10);
   _FClose(fchan);
}

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