Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS+ Products FreeRTOS Labs Integration Services 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 ]    [ FreeRTOS+ Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]


Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.