JavaScript Editor js editor     Web development 

Main Page

Writes exactly length bytes from your buffer to a file specified by chan.

unsigned int _FWrite(FCHAN chan, char FAR *buffer, int length)
FCHAN chan;               /* File channel of file to write to. */
char FAR *buffer;            /* Buffer address. */
int length;                  /* Number of bytes to write. */


_FWrite(В ) doesn't add a terminator to the file. No translation is performed on the bytes before they are written. _FWrite(В ) returns the number of bytes written.

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 test file and writes some data to it using _FWrite(В ).

Visual FoxPro Code

В Copy Code

C Code

В Copy 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);

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

See Also

JavaScript Editor js editor     Web development