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.
Parameters:
| 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
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 ); lWritePosition++; } else { /* There is no more space in the buffer. */ break; } } /* Finished with the file. */ f_close( pxFile ); /* Return the number of bytes read. */ return lWritePosition; } Example use of the f_eof() API function