被制御シーケンスに作成された要素の数を返します。
streamsize pcount( ) const;
戻り値
被制御シーケンスに作成された要素の数。
解説
具体的には pptr が null ポインターの場合、関数のゼロを返します。それ以外の場合は pptr – pbaseを返します。
使用例
// 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;
}
出力
5
10
必要条件
ヘッダー: <strstream>
名前空間: std