Real time embedded FreeRTOS RSS feed 
Homepage FreeRTOS+ Products FreeRTOS Labs Support Forum Contact / Enquiries

f_tell()

[FreeRTOS Embedded File System API]

header_file.h
long f_tell( F_FILE *pxFileHandle );
		

Return the current read/write position of an open file in the FAT file system.

Parameters:

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

Returns:
-1   F_FS_THREAD_AWARE is set to 1 and a file system lock could not be obtained before F_MAX_LOCK_WAIT_TICKS elapsed.

Any other value.   The returned value is the current read/write position within the open file.

See also

f_seek()

Example usage:


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

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

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

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

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

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

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

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


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


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