std::ostrstream::pcount (3) - Linux Manuals
std::ostrstream::pcount: std::ostrstream::pcount
Command to display std::ostrstream::pcount
manual in Linux: $ man 3 std::ostrstream::pcount
NAME
std::ostrstream::pcount - std::ostrstream::pcount
Synopsis
int pcount() const;
Returns the number of characters that were output in the put area of the associated std::strstreambuf. Effectively calls rdbuf()->pcount()
Parameters
(none)
Return value
The number of characters in the put area, or zero if nothing was output.
Example
// Run this code
#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';
}
Output:
The size of the output is 11 and it holds "Test: 1.23"
1.23
See also
returns the next pointer minus the beginning pointer in the output sequence: the number of characters written
pcount (public member function of std::strstreambuf)
Pages related to std::ostrstream::pcount
- std::ostrstream::freeze (3) - std::ostrstream::freeze
- std::ostrstream::ostrstream (3) - std::ostrstream::ostrstream
- std::ostrstream::rdbuf (3) - std::ostrstream::rdbuf
- std::ostrstream::str (3) - std::ostrstream::str
- std::ostrstream::~ostrstream (3) - std::ostrstream::~ostrstream
- std::ostrstream (3) - std::ostrstream
- std::ostream (3) - std::basic_ostream
- std::ostream_iterator (3) - std::ostream_iterator
- std::ostream_iterator<T,CharT,Traits>::operator++ (3) - std::ostream_iterator<T,CharT,Traits>::operator++
- std::ostream_iterator<T,CharT,Traits>::operator= (3) - std::ostream_iterator<T,CharT,Traits>::operator=
- std::ostream_iterator<T,CharT,Traits>::ostream_iterator (3) - std::ostream_iterator<T,CharT,Traits>::ostream_iterator
- std::ostream_iterator<T,CharT,Traits>::~ostream_iterator (3) - std::ostream_iterator<T,CharT,Traits>::~ostream_iterator
- std::ostreambuf_iterator (3) - std::ostreambuf_iterator