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


[FreeRTOS Embedded File System API]

unsigned char f_eof( F_FILE *pxFileHandle );

Determine if the current read/write position in an open FAT file is the end of the file.


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

0   The current file read/write position is not at the end of the file.

Any other value   The current file read/write position is at the end of the file, or an error occurred.

See also

f_write(), f_read().

Example usage:

long lSampleFunction ( const char *pcFileName, char *pcBuffer, long lBufferSize )
F_FILE *pxFile;
long lWritePosition = 0;

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

    /* While there are more bytes to read. */
    while( f_eof( pxFile ) == 0 )
        /* If there is space left in the buffer. */
        if( lWritePosition < lBufferSize )
            /* Read the next byte. */
            f_read( &( pcBuffer[ lWritePosition ] ), 1, 1, pxFile );
            /* There is no more space in the buffer. */

    /* Finished with the file. */
    f_close( pxFile );

    /* Return the number of bytes read. */
    return lWritePosition;
Example use of the f_eof() 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.