[ ]
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS Labs FreeRTOS+TCP FreeRTOS+FAT FreeRTOS+POSIX 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_ftell()

[FreeRTOS+FAT Standard API Reference]

ff_stdio.h
long ff_ftell( FF_FILE *pxStream );
		

Returns the current read/write position of an open file in the embedded FAT file system. The position is returned as the number of bytes from the start of the file.

Parameters:

pxStream   The file being queried. The file must have first been opened using a call to ff_fopen().
Returns:

If pxStream is not NULL then the file's current read/write position is returned. The returned value is the number of bytes the file's read/write position is from the start of the file.

If pxStream is NULL then -1 is returned.

Example usage:


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

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

    /* Expect the file position to be 0. */
    lPosition = ff_ftell( pxFile );
    configASSERT( lPosition == 0 );

    /* Read one byte. */
    ff_fread( pcBuffer, 1, 1, pxFile );

    /* Expect the file position to be 1. */
    lPosition = ff_ftell( pxFile );
    configASSERT( lPosition == 1 );

    /* Read another byte. */
    ff_fread( pcBuffer, 1, 1, pxFile );

    /* Expect the file position to be 2. */
    lPosition = ff_ftell( pxFile );
    configASSERT( lPosition == 2 );

    /* Close the file again. */
    ff_fclose( pxFile );
}
						
Example use of the ff_ftell() API function



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




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