std::strstream::pcount
Min standard notice:
Returns the number of characters that were output in the put area of the associated std::strstreambuf. Effectively calls rdbuf()->pcount().
# Declarations
int pcount() const;
(deprecated in C++98) (removed in C++26)
# Return value
The number of characters in the put area, or zero if nothing was output.
# Example
#include <iostream>
#include <strstream>
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';
}