FF_FILE *ff_truncate( const char * pcFileName, long lTruncateSize );
Opens a file for writing, then truncates the file’s length to lTruncateSize.
If the file was longer than lTruncateSize then the data past lTruncateSize
If the file was shorter than lTruncateSize then new data added to the end
of the file is set to 0.
A pointer to a standard null terminated C string that holds
the name of the file being opened and truncated. The file name can
include a relative path to the file.
The length, in byte, to which the file’s length will be
If the length of the file was successfully set to lTruncateSize then a
pointer to the opened file is returned.
If the length of the file was not successfully set to lTruncateSize then
NULL is returned, the file will remain closed, and the task’s
errno is set to indicate the reason. A task
can obtain its errno value using the ff_errno()
void vSampleFunction( char *pcFileName, long lLength )
pxFile = ff_truncate( pcFileName, lLength );
if( pxFile == NULL )
ff_fclose( pxFile );
Example use of the ff_truncate() API function
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.