[ ]
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_feof()

[FreeRTOS+FAT Standard API Reference]

ff_stdio.h
int ff_feof( FF_FILE *pxStream );
		

Queries an open file in the embedded FAT file system to see if the file's read/write pointer is at the end of the file.

Parameters:

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

If the file's read/write pointer is at the end of the file then a non-zero value is returned.

If the file's read/write pointer is not at the end of the file, and no errors occur, then zero is returned and the task's errno is also set to zero.

If an error prevents the function from determining the position of the file's read/write pointer then zero is returned and the task's errno is set to indicate the reason.

A task can obtain its errno value using the ff_errno() API function.

Example usage:


void vSampleFunction( char *pcFileName, char *pcBuffer, int32_t lBufferSize )
{
FF_FILE *pxFile;
int32_t lBytesRead;
int iReturnedByte;

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

    /* Read the number of bytes specified by the lBufferSize parameter. */
    for( lBytesRead = 0; lBytesRead < lBufferSize; lBytesRead++ )
    {
        if( ff_feof( pxFile ) != 0 )
        {
            /* The end of the file has been reached, there are no more bytes to
            read. */
            break;
        }
        else
        {
            iReturnedByte = ff_fgetc( pxFile );
        }

        /* Write the byte into the buffer. */
        pcBuffer[ lBytesRead ] = ( char ) iReturnedByte;
    }

    /* Finished with the file. */
    ff_fclose( pxFile );
}
						
Example use of the ff_feof() 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.