std::basic_istream::tellg
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
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).
Parámetros
(Ninguno)
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.
Valor de retorno
current position of the get pointer on success, pos_type(-1) on failure
Ejemplo
Ejecuta este código
#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';
}
Salida:
After reading the word "Hello," tellg() returns 6
Ver también
| Establece el indicador de la posición de entrada. (función miembro pública) | |
| Devuelve el indicador de la posición de salida. (función miembro pública de std::basic_ostream<CharT,Traits>)
| |
| Establece el indicador de la posición de salida. (función miembro pública de std::basic_ostream<CharT,Traits>)
|