_FCopy( ) API Library Routine Example
The following example creates two files. It writes the text "Hello, world" to the first of these files and then copies the contents of this file, beginning with the third byte, to the second file.
SET LIBRARY TO FCOPY
#include <pro_ext.h>
FAR Example(ParamBlk FAR *parm)
{
FCHAN fchan1, fchan2;
int len;
fchan1 = _FCreate("temp1.txt", FC_NORMAL);
_FPuts(fchan1, "Hello, world.");
_FFlush(fchan1);
len = _FSeek(fchan1, 0, FS_FROMEOF); // determine length of file
fchan2 = _FCreate("temp2.txt", FC_NORMAL);
_FCopy(fchan2, 0, fchan1, 2, len - 2);
_FClose(fchan1);
_FClose(fchan2);
}
FoxInfo myFoxInfo[] = {
{"FCOPY", (FPFI) Example, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};