JavaScript Editor js editor     Web development 

Main Page

Assigns a Visual FoxPro channel to a new file.

FCHAN _FCreate(char FAR *filename, int mode)
char FAR *filename;         /* Name of file to create. */
int mode;                     /* File attributes. */


If a file with the specified name already exists, _FCreate(В ) truncates the existing file to zero bytes.

The mode parameter may be one or more of the following flags: FC_READONLY, FC_SYSTEM, FC_HIDDEN, and FC_TEMPORARY. You can combine these flags using the C or + operator. An additional flag, FC_NORMAL, specifies that the file has none of the other attributes. FC_TEMPORARY files are automatically deleted when you call _FClose(В ) to close the file.

_FCreate( ) returns the file channel if it succeeds in creating the file, or – 1 if it fails.

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 uses _FCreate(В ) to create a number of files using the various mode flags of _FCreate(В ).

Visual FoxPro Code

В Copy Code

C Code

В Copy Code
#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
   FCHAN fchan;

   fchan = _FCreate("normal.tmp", FC_NORMAL);

   fchan = _FCreate("readonly.tmp", FC_READONLY);

   fchan = _FCreate("hidden.tmp", FC_HIDDEN);

   fchan = _FCreate("system.tmp", FC_SYSTEM);

   fchan = _FCreate("temp.tmp", FC_TEMPORARY);

   fchan = _FCreate("multi.tmp", FC_SYSTEM | FC_READONLY);

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

See Also

JavaScript Editor js editor     Web development