This site required JavaScript
to be enabled. Click here to
view a static menu.
int ff_fputc( int iChar, FF_FILE * pxStream );
Write a single byte to an open file in the embedded FAT file system. The read/write position is incremented by one.
Passing a char in an int may not seem optimal, but the ff_fputc() prototype conforms to the standand and expected stdio fputc() function prototype.
Parameters:
On success the byte written to the file is returned. If any other value is returned then the byte was not written to the file and the task's errno will be set to indicate the reason. A task can obtain its errno value using the ff_errno() API function.
Example usage:
void vSampleFunction( char *pcFileName, int32_t lNumberToWrite )
{
FF_FILE *pxFile;
const int iCharToWrite = 'A';
int iCharWritten;
int32_t lBytesWritten;
/* Open the file specified by the pcFileName parameter for writing. */
pxFile = ff_fopen( pcFileName, "w" );
/* Write 'A' to the file the number of times specified by the
lNumberToWrite parameter. */
for( lBytesWritten = 0; lBytesWritten < lNumberToWrite; lBytesWritten++ ) { /* Write the byte. */
iCharWritten = ff_fputc( iCharToWrite, pxFile );
/* Was the character written to the file successfully? */
if( iCharWritten != iCharToWrite )
{
/* The byte could not be written to the file. */
break;
}
}
/* Finished with the file. */
ff_fclose( pxFile );
}