std::putwchar
来自cppreference.com
| 在标头 <cwchar> 定义
|
||
| |
||
写入宽字符 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 名: "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 (函数) | |
| 写宽字符到文件流 (函数) | |
putwchar 的 C 文档
| |