Real time embedded FreeRTOS RSS feed 
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) Amazon Web Services, Inc. or its affiliates. All rights reserved.