std::basic_istream<CharT,Traits>::tellg

Returns input position indicator of the current associated streambuf object.

# Declarations

pos_type tellg();

# Return value

The current position of the get pointer on success, pos_type(-1) on failure.

# Example

#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';
}

# See also