f_seteof()

[FreeRTOS Embedded File System API]

header_file.h
int f_seteof( F_FILE *pxFileHandle );
		

Truncates a file to the current file read/write position. All data after the current read/write position is lost.

Parameters:

pxFileHandle   The handle of the file being truncated. The handle is returned by the call to f_open() originally used to open the file.

Returns:
F_NO_ERROR   The file was successfully truncated.

Any other value   The file was not successfully truncated. The returned value holds the error code.

See also

f_truncate

Example usage:

void vSampleFunction( char *pcFileName, long lTruncatePosition ) { F_FILE *pxFile; /* Open the file specified by the pcFileName parameter. */ pxFile = f_open( pcFileName, "r+" ); /* Move the current read/write position to the position specified by the lTruncatePosition parameter. */ f_seek( pxFile, lTruncatePosition, F_SEEK_SET ); /* Truncate the file so all data past the current file position is lost. */ if( f_seteof( pxFile ) != F_NO_ERROR ) { /* The truncate failed. */ } /* Finished with the file. */ f_close( pxFile ); } Example use of the f_seteof() API function