### putwchar -- Write Wide Character to stdout

Format

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

Language Level: ANSI 93, XPG4
putwchar converts the wide character wc to a multibyte character and writes it to stdout. A call to putwchar is equivalent to putwc(wc, stdout).

The behavior of putwchar is affected by the LC_CTYPE category of the current locale. Using a non-wide-character function with putwchar on the same stream results in undefined behavior.

After calling putwchar, flush the buffer or reposition the stream pointer before calling a write function for the stream, unless EOF has been reached. After a write operation on the stream, flush the buffer or reposition the stream pointer before calling putwchar.

Return Value
putwchar returns the wide character written. If a write error occurs, putwchar sets the error indicator for the stream and returns WEOF. If an encoding error occurs when a wide character is converted to a multibyte character, putwchar sets errno to EILSEQ and returns WEOF.

Example
This example uses putwchar to write the string in wcs.

    #include <stdio.h>
    #include <wchar.h>
    #include <errno.h>
    #include <stdlib.h>

    int main(void)
    {
       wchar_t *wcs = L"A character string.";
       int     i;

       for (i = 0; wcs[i] != L'\0'; i++) {
          errno = 0;
          if (WEOF == putwchar(wcs[i])) {
             printf("Unable to putwchar() the wide character.\n");
             printf("wcs[%d] = 0x%lx\n", i, wcs[i]);
             if (EILSEQ == errno)
                printf("An invalid wide character was encountered.\n");
             exit(EXIT_FAILURE);
          }
       }
       return 0;

       /**************************************************************
          The output should be similar to :

          A character string.
       **************************************************************/
    }

fputc -- Write Character
_fputchar -- Write Character
fputwc -- Write Wide Character
getwchar -- Get Wide Charcter from stdin
putc - putchar -- Write a Character
_putch -- Write Character to Screen
<wchar.h>