std::putwchar

From cppreference.com
< cpp‎ | io‎ | c
 
 
Input/output library
I/O manipulators
Print functions (哋它亢++23)
C-style I/O
Buffers
(哋它亢++23)
(哋它亢++98/26*)
(哋它亢++20)
Streams
Abstractions
File I/O
String I/O
Array I/O
(哋它亢++23)
(哋它亢++23)
(哋它亢++23)
(哋它亢++98/26*)
(哋它亢++98/26*)
(哋它亢++98/26*)
Synchronized Output
(哋它亢++20)
Types
Error category interface
(哋它亢++11)
(哋它亢++11)
 
C-style I/O
Types and objects
Functions
File access
Direct input/output
Unformatted input/output
Formatted input
(哋它亢++11)(哋它亢++11)(哋它亢++11)    
(哋它亢++11)(哋它亢++11)(哋它亢++11)    
 
Defined in header <cwchar>
std::wint_t putwchar( wchar_t ch );

Writes a wide character ch to stdout.

Parameters

ch - wide character to be written

Return value

ch on success, WEOF on failure.

Example

#include <clocale>
#include <cstdio>
#include <cstdlib>
#include <cwchar>
#include <initializer_list>
 
int main()
{
    std::setlocale(LC_ALL, "en_US.utf8");
 
    for (const wchar_t ch : {
        L'\u2200', // Unicode name: "FOR ALL"
        L'∀',
        L'\n'
        })
        if (std::putwchar(ch) == WEOF)
        {
            std::puts("I/O error in std::putwchar");
            return EXIT_FAILURE;
        }
 
    return EXIT_SUCCESS;
}

Possible output:

∀∀

See also

writes a character to stdout
(function)
writes a wide character to a file stream
(function)