GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::basic_istream::tellg(3) C++ Standard Libary std::basic_istream::tellg(3)

std::basic_istream::tellg - std::basic_istream::tellg


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).


(none)


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


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.

// Run this code


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


After reading the word "Hello," tellg() returns 6


seekoff repositions the file position, using relative addressing
[virtual] (virtual protected member function of std::basic_filebuf<CharT,Traits>)
repositions the next pointer in the input sequence, output sequence, or
seekoff both, using relative addressing
[virtual] (virtual protected member function of
std::basic_stringbuf<CharT,Traits,Allocator>)
seekoff repositions the next pointer in the input sequence, output sequence, or
[virtual] both, using relative addressing
(virtual protected member function of std::strstreambuf)
seekg sets the input position indicator
(public member function)
tellp returns the output position indicator
(public member function of std::basic_ostream<CharT,Traits>)
seekp sets the output position indicator
(public member function of std::basic_ostream<CharT,Traits>)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.