FatFs - f_putc

## f_putc

The f_putc funciton puts a character to the file.

    int f_putc (
      TCHAR chr,  /* [IN] A character to put */
      FIL* fp     /* [IN] File object */
    );

#### Parameters

chr
  A character to be put.
fp
  Pointer to the open file object structuer.

#### Return Values

When the character was written successfuly, it returns number of character encoding units written to the file. When the function failed due to disk full or any error, an `EOF (-1)` will be returned.

#### Description

When FatFs is configured for Unicode API (`FF_LFN_UNICODE >= 1`), character encoding on the string fuctions, `f_putc`, `f_puts`, `f_printf` and `f_gets` function, is also switched to Unicode. The character encoding on the file to be written via those functions is selected by `FF_STRF_ENCODE` option. The Unicode characters in multiple encoding unit, such as surrogate pair and multi-byte sequence, cannot be written by this function.

#### QuickInfo

This is a wrapper function of `f_write` function. Available when `FF_FS_READONLY == 0` and `FF_USE_STRFUNC` is 1 or 2. When it is set to 2, a `'\n'` is converted to `'\r'+'\n'`.

#### See Also

`f_open, f_puts, f_printf, f_gets, f_close, FIL`

Return