命名空间
变体
操作

std::putwchar

来自 cppreference.cn
< cpp‎ | io‎ | c
 
 
 
 
在头文件 <cwchar> 中定义
std::wint_t putwchar( wchar_t ch );

将宽字符 ch 写入到 stdout

目录

[编辑] 参数

ch - 要写入的宽字符

[编辑] 返回值

成功时返回 ch,失败时返回 WEOF

[编辑] 示例

#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;
}

可能的输出

∀∀

[编辑] 参阅

stdout 写入一个字符
(函数) [编辑]
向文件流写入一个宽字符
(函数) [编辑]
有关 putwcharC 文档