Real time embedded FreeRTOS RSS feed 
Homepage FreeRTOS+ Products FreeRTOS Labs Integration Services Contact / Enquiries


[FreeRTOS Embedded File System API]

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.


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

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


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

[ Back to the top ]    [ About FreeRTOS ]    [ FreeRTOS+ Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.