std:: fputwc
From ja.cppreference.net
|
定義済みヘッダー
<cwchar>
|
||
|
std::
wint_t
fputwc
(
wchar_t
ch,
std::
FILE
*
stream
)
;
|
(1) | |
|
std::
wint_t
putwc
(
wchar_t
ch,
std::
FILE
*
stream
)
;
|
(2) | |
指定された出力ストリーム stream にワイド文字 ch を書き込みます。
2)
マクロとして実装される可能性があり、
stream
を複数回評価する場合があります。
目次 |
パラメータ
| ch | - | 書き込むワイド文字 |
| stream | - | 出力ストリーム |
戻り値
ch 成功時、 WEOF 失敗時。エンコーディングエラーが発生した場合、 errno は EILSEQ に設定される。
例
このコードを実行
#include <cerrno> #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'\n', L'∀', }) { if (errno = 0; std::fputwc(ch, stdout) == WEOF) { std::puts(errno == EILSEQ ? "Encoding error in fputwc" : "I/O error in fputwc" ); return EXIT_FAILURE; } } return EXIT_SUCCESS; }
出力例:
∀ ∀
関連項目
|
ファイルストリームに文字を書き込む
(関数) |
|
|
ファイルストリームにワイド文字列を書き込む
(関数) |
|
|
ファイルストリームからワイド文字を取得する
(関数) |
|
|
Cドキュメント
for
fputwc
|
|