fputwc, putwc

Header: <wchar.h>

Writes a wide character ch to the given output stream stream.

# Declarations

wint_t fputwc( wchar_t ch, FILE* stream );

(since C95)

wint_t putwc( wchar_t ch, FILE* stream );

(since C95)

# Parameters

# Return value

Returns a copy of ch on success.

# Example

#include <errno.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
 
int main(void)
{
    setlocale(LC_ALL, "en_US.utf8");
 
    errno = 0;
    if (fputwc(L'🍌', stdout) == WEOF)
    {
        if (errno == EILSEQ)
            puts("Encoding error in fputwc.");
        else
            puts("I/O error in fputwc.");
        return EXIT_FAILURE;
    }
}

# See also