std::basic_istream::tellg
From cppreference.com
                    
                                        
                    < cpp | io | basic istream
                    
                                                            
                    |   pos_type tellg();  | 
||
Returns input position indicator of the current associated streambuf object.
First, constructs a std::basic_istream::sentry object with noskipws set to true. Afterwards, if fail()==true, returns pos_type(-1). Otherwise, returns rdbuf()->pubseekoff(0, std::ios_base::cur, std::ios_base::in).
Contents | 
[edit] Parameters
(none)
[edit] Return value
current position of the get pointer on success, pos_type(-1) on failure
[edit] Example
#include <iostream> #include <string> #include <sstream> 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'; }
Output:
After reading the word "Hello," tellg() returns 6
[edit] See also
|    sets the input position indicator  (public member function)  | |
|    returns the output position indicator  (public member function of std::basic_ostream)  | |
|    sets the output position indicator  (public member function of std::basic_ostream)  | |