std::basic_istream<CharT,Traits>:: tellg
|
pos_type tellg
(
)
;
|
||
現在関連付けられている
streambuf
オブジェクトの入力位置インジケータを返します。
UnformattedInputFunction として振る舞うが、 gcount() には影響を与えない。セントリオブジェクトの構築とチェックの後、 fail ( ) == true の場合、 pos_type ( - 1 ) を返す。それ以外の場合、 rdbuf ( ) - > pubseekoff ( 0 , std:: ios_base :: cur , std:: ios_base :: in ) を返す。
目次 |
パラメータ
(なし)
戻り値
成功時はゲットポインタの現在位置、 pos_type ( - 1 ) 失敗時。
例外
内部操作が例外をスローした場合、それはキャッチされ、
badbit
が設定されます。
exceptions()
が
badbit
に対して設定されている場合、例外は再スローされます。
例
#include <iostream> #include <sstream> #include <string> int main() { std::string str = "Hello, world"; std::istringstream in(str); std::string word; in >> word; std::cout << "After reading the word \"" << word << "\" tellg() returns " << in.tellg() << '\n'; }
出力:
After reading the word "Hello," tellg() returns 6
関連項目
|
[virtual]
|
ファイル位置を相対アドレッシングを使用して再配置する
(
std::basic_filebuf<CharT,Traits>
の仮想保護メンバ関数)
|
|
[virtual]
|
入力シーケンス、出力シーケンス、またはその両方の次のポインタを相対アドレッシングを使用して再配置する
(
std::basic_stringbuf<CharT,Traits,Allocator>
の仮想保護メンバ関数)
|
|
[virtual]
|
入力シーケンス、出力シーケンス、またはその両方の次のポインタを相対アドレッシングを使用して再配置する
(
std::strstreambuf
の仮想保護メンバ関数)
|
|
入力位置指示子を設定する
(公開メンバ関数) |
|
|
出力位置指示子を返す
(
std::basic_ostream<CharT,Traits>
の公開メンバ関数)
|
|
|
出力位置指示子を設定する
(
std::basic_ostream<CharT,Traits>
の公開メンバ関数)
|