header_file.h
int f_getc( F_FILE *pxFileHandle );
Reads a single byte from the current read/write position of an open FAT file. The current file
position is incremented by one.
A file can only be read if it was opened with one of the following
option strings: "r", "r+", "w+" or "a+" (see f_open()).
Parameters:
pxFileHandle
|
The handle of the file from which a character is being read.
The handle is returned by the call to f_open() used to
originally open the file.
|
Returns:
-1
|
A character was not read from the file.
|
Any other value
|
The character that was read from the file.
|
See also
f_read().
Example usage:
void vSampleFunction( char *pcFileName, char *pcBuffer, long lBufferSize )
{
F_FILE *pxFile;
long lBytesRead;
int iReturnedByte;
pxFile = f_open( pcFileName, "r" );
for( lBytesRead = 0; lBytesRead < lBufferSize; lBytesRead++ )
{
iReturnedByte = f_getc( pxFile );
if( iReturnedByte == -1 )
{
break;
}
else
{
pcBuffer[ lBytesRead ] = ( char ) iReturnedByte;
}
}
f_close( pxFile );
}
Example use of the f_getc() API function
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.