首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::fputws

Defined in header <cwchar>

int fputws( const wchar_t* str, std::FILE* stream );

从以空结尾的宽字符串写入每个宽字符。str到输出流stream,好像通过反复执行std::fputwc...

终止空宽字符的str不是写的。

参数

str

-

null-terminated wide string to be written

stream

-

output stream

返回值

在成功时,返回一个非负值.

失败时,返回EOF并设置误差指标%28见std::ferror29%stream...

二次

代码语言:javascript
复制
#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
}

二次

产出:

二次

代码语言:javascript
复制
御休みなさい

二次

另见

fputs

writes a character string to a file stream (function)

wprintffwprintfswprintf

prints formatted wide character output to stdout, a file stream or a buffer (function)

fputws

writes a wide string to a file stream (function)

fgetws

gets a wide string from a file stream (function)

c fputws文档

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券