?
本文檔使用 php中文網(wǎng)手冊(cè) 發(fā)布
在頭文件<wchar.h>中定義 | ||
---|---|---|
int fputws(const wchar_t * str,F(xiàn)ILE * stream); | (直到C99)(自C95以來(lái)) | |
int fputws(const wchar_t * restrict str,F(xiàn)ILE * restrict stream); | (自C99以來(lái)) |
將空終止的寬字符串str
中的每個(gè)字符寫入輸出流stream
,就像重復(fù)執(zhí)行一樣fputwc
。
str
不寫入終止空寬字符from 。
str | - | 以空字符結(jié)尾的寬字符串寫入 |
---|---|---|
流 | - | 輸出流 |
成功時(shí),返回一個(gè)非負(fù)值。
失敗時(shí),返回EOF
并設(shè)置錯(cuò)誤指示器(請(qǐng)參閱參考資料ferror
)stream
。
#include <locale.h>#include <stdio.h>#include <wchar.h> int main(void){ setlocale(LC_ALL, "en_US.utf8"); int rc = fputws(L"御休みなさい", stdout); if (rc == EOF) perror("fputws()"); // POSIX requires that errno is set}
輸出:
御休みなさい
C11標(biāo)準(zhǔn)(ISO / IEC 9899:2011):
7.29.3.4 fputws函數(shù)(p:423)
C99標(biāo)準(zhǔn)(ISO / IEC 9899:1999):
7.24.3.4 fputws函數(shù)(p:368)