fputws
来自 zh.cppreference.net
| 定义于头文件 <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 并设置 错误指示符(参见 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
}
可能的输出:
御休みなさい
参考文献
- C23 标准 (ISO/IEC 9899:2024):
- 7.29.3.4 The fputws function (p: TBD)
- C17 标准 (ISO/IEC 9899:2018):
- 7.29.3.4 The fputws function (p: TBD)
- C11 标准 (ISO/IEC 9899:2011):
- 7.29.3.4 The fputws function (p: 423)
- C99 标准 (ISO/IEC 9899:1999):
- 7.24.3.4 The fputws function (p: 368)
参阅
| 将字符串写入文件流 (函数) | |
(C95)(C95)(C95)(C11)(C11)(C11)(C11) |
将格式化宽字符输出写入 stdout、文件流或缓冲区 (函数) |
(C95) |
将宽字符串写入文件流 (函数) |
(C95) |
从文件流获取宽字符串 (函数) |
C++ 文档 关于 fputws
| |