F_FILE * f_truncate( const char * pcFileName, long lTruncateSize );
Opens a file for writing, then sets the length of the file to a specified
value. If the specified length is longer than the current file length then the
file is extended (rather than truncated) and the new space is padded with
zeros. If the specified length is shorter than the current file length
then the file is truncated and all data after the truncation point is lost.
The name of the file being opened and truncated. The
name is specified as a standard null terminated C string.
The length to which the opened file will be truncated/extended.
The file could not be opened.
Any other value
The returned value is the handle to the opened file.
void vSampleFunction( char *pcFileName, unsigned long ulLength )
/* Open and truncate the file specified by the pcFileName parameter. */
pxFile = f_truncate( pcFileName, ulLength );
if( pxFile == NULL )
/* The file could not be opened. */
/* The file was opened and the file length was set. *//*
* The file can be accessed here.
*//* Close the file when it is no longer required. */
f_close( pxFile );