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

std::ostrstream::pcount

int pcount() const;

?

?

的PUT区域中输出的字符数。std::strstreambuf.有效地打电话rdbuf()->pcount()...

参数

%280%29

返回值

PUT区域中的字符数,如果没有输出,则为零。

二次

代码语言:javascript
复制
#include <strstream>
#include <iostream>
 
int main()
{
    std::ostrstream dyn; // dynamically-allocated output buffer
    dyn << "Test: " << 1.23 << std::ends;
    std::cout << "The size of the output is " << dyn.pcount()
              << " and it holds \"" << dyn.str() << "\"\n";
    dyn.freeze(false);
 
    char buf[10];
    std::ostrstream user(buf, 10); // user-provided output buffer
    user << 1.23; // note: no std::ends
    std::cout.write(buf, user.pcount());
    std::cout << '\n';
}

二次

产出:

二次

代码语言:javascript
复制
The size of the output is 11 and it holds "Test: 1.23"
1.23

二次

另见

pcount

returns the next pointer minus the beginning pointer in the output sequence: the number of characters written (public member function of std::strstreambuf)

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

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com