Namespaces
Variants

std:: fputws

From cppreference.net
< cpp ‎ | io ‎ | c
ヘッダーで定義 <cwchar>
int fputws ( const wchar_t * str, std:: FILE * stream ) ;

ヌル終端ワイド文字列 str からすべてのワイド文字を出力ストリーム stream に書き込む。これは std::fputwc を繰り返し実行するのと同様である。

str からの終端ナルワイド文字は書き込まれません。

目次

パラメータ

str - 書き込むnull終端ワイド文字列
stream - 出力ストリーム

戻り値

成功時は、非負の値を返します

失敗時には、 EOF を返し、 error インジケータ( std::ferror 参照)を stream に設定します。

#include <clocale>
#include <cstdio>
#include <cwchar>
int main()
{
    std::setlocale(LC_ALL, "en_US.utf8");
    int rc = std::fputws(L"御休みなさい", stdout);
    if (rc == EOF)
        std::perror("fputws()"); // POSIX requires that errno is set
}

出力例:

御休みなさい

関連項目

ファイルストリームに文字列を書き込む
(関数)
書式化されたワイド文字出力を stdout 、ファイルストリーム、またはバッファに出力する
(関数)
fputws
ファイルストリームにワイド文字列を書き込む
(関数)
ファイルストリームからワイド文字列を取得する
(関数)