pos_type tellp();
概要
ストリームバッファから現在の書き込み位置を取得する。
戻り値
備考
C++11 から、本関数の処理開始時に sentry
オブジェクトを構築するようになった。
例
出力
ABCdef
ABCDEF
実装例
pos_type tellp(pos_type pos) {
sentry s(*this);
if (this->fail()) {
return pos_type(-1);
}
return this->rdbuf()->pubseekoff(0, cur, ios_base::out);
}
バージョン
言語
- C++98
参照
basic_ostream::seekp
basic_streambuf::pubseekoff