fputws

来自cppreference.com
< c‎ | io
 
 
 
在标头 <wchar.h> 定义
int fputws(constwchar_t*str, FILE*stream );
(C95 起)
(C99 前)
int fputws(constwchar_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 要求设置 errno}

输出:

洗洗睡吧

[编辑]引用

  • C11 标准(ISO/IEC 9899:2011):
  • 7.29.3.4 The fputws function (第 423 页)
  • C99 标准(ISO/IEC 9899:1999):
  • 7.24.3.4 The fputws function (第 368 页)

[编辑]参阅

将一个字符串写入文件流
(函数)[编辑]
打印格式化宽字符输出到 stdout、文件流或缓冲区
(函数)[编辑]
fputws
(C95)
将一个宽字符串写入文件流
(函数)[编辑]
(C95)
从文件流获取一个宽字符串
(函数)[编辑]
fputws 的 C++ 文档
close