名稱空間
變體
操作

fputws

來自 cppreference.com
< c‎ | io
 
 
檔案輸入/輸出
型別和物件
        
函式
檔案訪問
(C95)
非格式化輸入/輸出
(C95)(C95)
(C95)
(C95)(C95)
fputws
(C95)
(C95)

格式化輸入
 
在標頭檔案 <wchar.h> 中定義
int fputws( const wchar_t *str, FILE *stream );
(自 C95 起)
(直到 C99)
int fputws( const wchar_t * restrict str, FILE * restrict stream );
(C99 起)

將空終止的寬字串str中的每個字元寫入輸出流stream,就像重複執行fputwc一樣。

str中的終止空寬字元不會被寫入。

目錄

[編輯] 引數

str - 要寫入的空終止寬字串
stream - 輸出流

[編輯] 返回值

成功時,返回非負值。

失敗時,返回EOF並設定stream上的錯誤指示器(參見ferror)。

[編輯] 示例

#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 標準 (ISO/IEC 9899:2011)
  • 7.29.3.4 fputws 函式 (p: 423)
  • C99 標準 (ISO/IEC 9899:1999)
  • 7.24.3.4 fputws 函式 (p: 368)

[編輯] 另請參閱

將字元字串寫入檔案流
(函式) [編輯]
將格式化的寬字元輸出列印到 stdout、檔案流或緩衝區
(函式) [編輯]
fputws
(C95)
向檔案流寫入一個寬字串
(函式) [編輯]
(C95)
從檔案流中獲取一個寬字串
(函式) [編輯]