std::putwchar
來自 cppreference.com
在標頭檔案 <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 寫入一個字元 (函式) | |
向檔案流寫入一個寬字元 (函式) | |
有關 putwchar 的C 文件
|