[ ]
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS Labs FreeRTOS+TCP FreeRTOS+FAT Contact / Enquiries


FreeRTOS+FAT is still in the lab
FreeRTOS+FAT is already in use in commercial products and we encourage you to try it yourself. Be aware however that FreeRTOS+FAT was acquired by Real Time Engineers Ltd., and is still being documented and updated to ensure it meets our strict quality standards. Please use the forum for support, or contact us directly if you have a specific business interest.

ff_seteof()

[FreeRTOS+FAT Standard API Reference]

ff_stdio.h
int ff_seteof( FF_FILE *pxStream );
		

Truncates a file to the file's current read/write position. The file must have previously been opened using ff_fopen() with the mode string set to "a" or "w".

Parameters:

pxStream   The file being truncated.
Returns:

If the file was successfully truncated then zero is returned.

If the file could not be truncated then FF_EOF is returned and the task's errno is set to indicate the reason. A task can obtain its errno value using the ff_errno() API function.

Example usage:


void vSampleFunction( char *pcFileName, long lTruncatePosition )
{
FF_FILE *pxFile;

    /* Open the file specified by the pcFileName parameter. */
    pxFile = ff_fopen( pcFileName, "a" );

    /* Move the current read/write position to the position specified by
    the lTruncatePosition parameter. */
    ff_fseek( pxFile, lTruncatePosition, FF_SEEK_SET );

    /* Truncate the file so all data past the current file position is lost. */
    if( ff_seteof( pxFile ) != FF_EOF )
    {
        /* The truncate failed. */
    }

    /* Finished with the file. */
    ff_fclose( pxFile );
}
						
Example use of the ff_seteof() API function



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




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