header_file.h
int f_putc( int iChar, F_FILE *pxFileHandle );
Writes a single character into an open FAT file. The data is written at
the current file read/write position, and the current file read/write position is incremented
by one.
A file can only be written to if it was opened with one of the following
option strings: "w", "w+", "a+", "r+" or "a" (see f_open()).
Parameters:
iChar
|
The character to be written to the file.
The int data type is not appropriate to hold a character
but is used to comply with the expected standard file
system API.
|
pxFileHandle
|
The handle of the file to which the character is being written.
The handle is returned by the call to f_open() used to
originally open the file.
|
Returns:
The character being written
|
The character was successfully written to the file.
|
Any other value
|
The character was not successfully written to the file.
|
See also
f_write().
Example usage:
void vSampleFunction( char *pcFileName, long lNumberToWrite )
{
F_FILE *pxFile;
const int iCharToWrite = 'A';
int iCharWritten;
long lBytesWritten;
pxFile = f_open( pcFileName, "w" );
for( lBytesWritten = 0; lBytesWritten < lNumberToWrite; lBytesWritten++ )
{
iCharWritten = f_putc( iCharToWrite, pxFile );
if( iCharWritten != iCharToWrite )
{
break;
}
}
f_close( pxFile );
}
Example use of the f_putc() API function
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.