std::fputws
来自 cppreference.cn
| 在头文件 <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
| |