f_putc


Use this function to write a character to the specified open file at the current file position. The current file position is incremented.

Format

int f_putc ( 
    int        ch, 
    F_FILE *   filehandle )

Arguments

Argument Description Type
ch The character to write. int
filehandle The file handle. F_FILE *

Return values

Return value Description
-1 Operation failed.
value The successfully written character.

Example

void myfunc( char *filename, long num )
{
    int ch = 'A';
    F_FILE *file = f_open( filename, "w" );
    while (num > 0)
    {
        num--;
        if (ch != f_putc( 'ch', file ))
        {
            printf( "Error!" );
            break;
        }
    }
    f_close( file );
    return 0;
}