std::basic_istream::peek
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í. |
int_type peek(); |
||
Se comporta como
UnformattedInputFunction. Después de construir y probar el objeto centinela, lee el siguiente carácter del flujo de entrada sin extraerlo . Original:
Behaves as
UnformattedInputFunction. After constructing and testing the sentry object, reads the next character from the input stream without extracting it. 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.
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
Si
good() == true, devuelve el siguiente carácter como se obtiene por rdbuf()->sgetc()Original:
If
good() == true, returns the next character as obtained by rdbuf()->sgetc()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.
De lo contrario, devuelve
Traits::eof() .Original:
Otherwise, returns
Traits::eof().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.
Ejemplo
Ejecuta este código
#include <sstream>
#include <iostream>
int main()
{
std::istringstream s1("Hello, world.");
char c1 = s1.peek();
char c2 = s1.get();
std::cout << "Peeked: " << c1 << " got: " << c2 << '\n';
}
Salida:
Peeked: H got: H
Ver también
| Extrae caracteres. (función miembro pública) | |
unextracts un carácter Original: unextracts a character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función miembro pública) |