std::basic_istream::tellg
Aus cppreference.com
< cpp | io | basic istream
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
pos_type tellg(); |
||
Returns input position indicator of the current associated streambuf
object.
Behaves as UnformattedInputFunction
. 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).
Inhaltsverzeichnis |
[Bearbeiten] Parameter
(None)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Rückgabewert
current position of the get pointer on success, pos_type(-1) on failure
[Bearbeiten] Beispiel
#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
[Bearbeiten] Siehe auch
sets the input position indicator (öffentliche Elementfunktion) | |
gibt die Ausgabe Stellungsanzeige Original: returns the output position indicator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion of std::basic_ostream )
| |
setzt den Ausgang Stellungsanzeige Original: sets the output position indicator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion of std::basic_ostream )
|