Share via


strstreambuf::pcount

Returns a count of the number of elements written to the controlled sequence.

streamsize pcount( ) const;

Return Value

A count of the number of elements written to the controlled sequence.

Remarks

Specifically, if pptr is a null pointer, the function returns zero. Otherwise, it returns pptrpbase.

Example

// strstreambuf_pcount.cpp
// compile with: /EHsc
#include <iostream>
#include <strstream>
using namespace std;

int main( )
{
   strstream x;
   x << "test1";
   cout << x.rdbuf( )->pcount( ) << endl;
   x << "test2";
   cout << x.rdbuf( )->pcount( ) << endl;
}

Output

5
10

Requirements

Header: <strstream>

Namespace: std

See Also

Reference

strstreambuf Class

iostream Programming

iostreams Conventions