strstreambuf::pcount

被制御シーケンスに作成された要素の数を返します。

streamsize pcount( ) const;

戻り値

被制御シーケンスに作成された要素の数。

解説

具体的には pptr が null ポインターの場合、関数のゼロを返します。それ以外の場合は pptrpbaseを返します。

使用例

// 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

参照

関連項目

strstreambuf Class

入出力ストリームのプログラミング

入出力ストリームの規則