std::basic_istream<CharT,Traits>::tellg (3) - Linux Manuals
std::basic_istream<CharT,Traits>::tellg: std::basic_istream<CharT,Traits>::tellg
NAME
std::basic_istream<CharT,Traits>::tellg - std::basic_istream<CharT,Traits>::tellg
Synopsis
pos_type tellg();
Returns input position indicator of the current associated streambuf object.
Behaves as UnformattedInputFunction, except that gcount() is not affected. After constructing and checking the sentry object, if fail() == true, returns pos_type(-1). Otherwise, returns rdbuf()->pubseekoff(0, std::ios_base::cur, std::ios_base::in).
Parameters
(none)
Return value
The current position of the get pointer on success, pos_type(-1) on failure
Exceptions
failure if an error occurred (the error state flag is not goodbit) and exceptions() is set to throw for that state.
If an internal operation throws an exception, it is caught and badbit is set. If exceptions() is set for badbit, the exception is rethrown.
Example
// Run this code
Output:
See also
seekoff repositions the file position, using relative addressing
[virtual]
seekoff repositions the next pointer in the input sequence, output sequence, or both, using relative addressing
[virtual]
seekoff repositions the next pointer in the input sequence, output sequence, or both, using relative addressing
[virtual]
seekg (public member function)
tellp (public member function of std::basic_ostream<CharT,Traits>)
seekp (public member function of std::basic_ostream<CharT,Traits>)