C参考手册
文件输入/输出 | File input/output
fputws
在头文件<wchar.h>中定义 |
|
|
---|---|---|
int fputws(const wchar_t * str,FILE * stream); |
|
(直到C99)(自C95以来) |
int fputws(const wchar_t * restrict str,FILE * restrict stream); |
|
(自C99以来) |
将空终止的宽字符串str
中的每个字符写入输出流stream
,就像重复执行一样fputwc
。
str
不写入终止空宽字符from 。
参数
str |
- |
以空字符结尾的宽字符串写入 |
---|---|---|
流 |
- |
输出流 |
返回值
成功时,返回一个非负值。
失败时,返回EOF
并设置错误指示器(请参阅参考资料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标准(ISO / IEC 9899:2011):
- 7.29.3.4 fputws函数(p:423)
- C99标准(ISO / IEC 9899:1999):
- 7.24.3.4 fputws函数(p:368)