Next: remove, Previous: putw, Up: Stdio

### 4.51 `putwchar`, `putwchar_unlocked`—write a wide character to standard output

Synopsis

         #include <wchar.h>
         wint_t putwchar(wchar_t wc);

         #include <wchar.h>
         wint_t putwchar_unlocked(wchar_t wc);

         #include <wchar.h>
         wint_t _putwchar_r(struct _reent *reent, wchar_t wc);

         #include <wchar.h>
         wint_t _putwchar_unlocked_r(struct _reent *reent, wchar_t wc);

Description
The `putwchar` function or macro is the wide-character equivalent of the `putchar` function. It writes the wide character wc to stdout.

`putwchar_unlocked` is a non-thread-safe version of `putwchar`. `putwchar_unlocked` may only safely be used within a scope protected by flockfile() (or ftrylockfile()) and funlockfile(). This function may safely be used in a multi-threaded program if and only if they are called while the invoking thread owns the (FILE *) object, as is the case after a successful call to the flockfile() or ftrylockfile() functions. If threads are disabled, then `putwchar_unlocked` is equivalent to `putwchar`.

The alternate functions `_putwchar_r` and `_putwchar_unlocked_r` are reentrant versions of the above. The extra argument reent is a pointer to a reentrancy structure.

Returns
If successful, `putwchar` returns its argument wc. If an error intervenes, the result is `EOF`. You can use ``ferror(stdin)`' to query for errors.

Portability
`putwchar` is required by C99.

`putwchar_unlocked` is a GNU extension.