Export (0) Print
Expand All
Expand Minimize

_FCHSize( ) API Library Routine

Visual Studio .NET 2003

Sets the size on disk of the specified file to the specified length.

int _FCHSize(FCHAN chan, long length)
FCHAN chan;               /* File to change. */
long length;                  /* New length for the file in bytes. */


The specified length may extend or truncate the file. _FCHSize( ) returns 0 if it's successful in changing the length of 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 creates a file Temp.txt and sets its size to 8196 bytes using _FCHSize( ).

Visual FoxPro Code

DIR  temp.txt

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
   FCHAN fchan = _FCreate("temp.txt", FC_NORMAL);
   _FCHSize(fchan, 8196);

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

See Also

_FGets( ) API Library Routine |_FPuts( ) API Library Routine | _FWrite( ) API Library Routine

© 2015 Microsoft