std::strstream::pcount(3)
πΈ NAME πΈ
std::strstream::pcount - std::strstream::pcount
okay so this page is all about std::strstream::pcount, straight out of the C++ Standard Libary manual (that's the manual name, keeping it exactly as it appears bestie π
). She's the member function that tells you how many characters got written into the put area. Periodt. β¨
π¦ Synopsis π¦
int pcount() const; (deprecated in C++98)
(removed in C++26)
π¨ okay bestie, important vibe check: pcount() is deprecated in C++98 and removed in C++26. So she's iconic but very much legacy-coded. π
Returns the number of characters that were output in the put area of the associated std::strstreambuf. Effectively calls rdbuf()->pcount().
π Parameters π
(none) β literally no parameters, bestie. She takes nothing. π
π₯ Return value π₯
The number of characters in the put area, or zero if nothing was output. So yes, if you wrote stuff you get the count, and if you wrote nothing it's a big fat zero. π«Ά
β¨ Example β¨
// Run this code
#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';
}
π Output: π
The size of the output is 11 and it holds "Test: 1.23"
1.23
π See also π
pcountβ returns the next pointer minus the beginning pointer in the output sequence:pcountthe number of characters written (public member function ofstd::strstreambuf).
mwah π this little page came from http://cppreference.com, dated 2024.06.10, and it's std::strstream::pcount(3) β bye bestie, go count those chars! π«Άπ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms