Share via


_FPuts( ) API Library Routine

Writes a specified null-terminated string to a file, followed by a carriage return/line feed pair.

unsigned int _FPuts(FCHAN chan, char FAR *buffer)
FCHAN chan;               /* File channel of file to write to. */
char FAR *buffer;            /* String to write. */

Remarks

_FPuts( ) returns the total number of bytes it writes to the file.

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 writes the text "Hello, world." to the file using _FPuts( ).

Visual FoxPro Code

SET LIBRARY TO FPUTS 

C Code

#include <pro_ext.h>

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

   fchan = _FCreate("temp.tmp", FC_NORMAL);
   _FPuts(fchan, "Hello, world.");
   _FClose(fchan);
}

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

See Also

Reference

_FFlush( ) API Library Routine

_FSeek( ) API Library Routine

_FWrite( ) API Library Routine

Other Resources

API Library Construction

Accessing the Visual FoxPro API