名稱空間
變體
操作

std::putwchar

來自 cppreference.com
< 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 文件