std::fputws
来自cppreference.com
                    
                                        
                    
                    
                                                            
                    |   在标头  <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 要求设置 errno }
输出:
御休みなさい
参阅
|   写字符串到文件流  (函数)  | |
|   打印有格式宽字符输出到 stdout、文件流或缓冲区  (函数)  | |
|     fputws  | 
  写宽字符串到文件流  (函数)  | 
|   从文件流获取宽字符串  (函数)  |