std::fputws
來自 cppreference.com
在標頭檔案 <cwchar> 中定義 |
||
int fputws( const wchar_t* str, std::FILE* stream ); |
||
將空終止寬字串 str
中的每個寬字元寫入到輸出流 stream
,如同透過重複執行 std::fputwc。
str
中的終止空寬字元不會被寫入。
目錄 |
[編輯] 引數
str | - | 要寫入的空終止寬字串 |
stream | - | 輸出流 |
[編輯] 返回值
成功時,返回非負值。
失敗時,返回 EOF 並設定 stream
上的錯誤指示器(見 std::ferror)。
[編輯] 示例
執行此程式碼
#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 |
向檔案流寫入一個寬字串 (函式) |
從檔案流中獲取一個寬字串 (函式) | |
C 文件 關於 fputws
|