std::strstream::pcount
std::strstream::pcount
int pcount() const; | | |
---|
的PUT区域中输出的字符数。std::strstreambuf.有效地打电话rdbuf()->pcount()...
参数
%280%29
返回值
PUT区域中的字符数,如果没有输出,则为零。
例
二次
#include <strstream>
#include <iostream>
int main()
{
std::strstream 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::strstream user(buf, 10 // user-provided output buffer
user << 1.23; // note: no std::ends
std::cout.write(buf, user.pcount()
std::cout << '\n';
}
二次
产出:
二次
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) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。