std::basic_istream::peek
Da cppreference.com.
< cpp | io | basic istream
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
int_type peek(); | ||
Si comporta come
UnformattedInputFunction
. Dopo la costruzione e la verifica dell'oggetto sentinella, legge il carattere successivo dal flusso di input senza estrarlo. 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.
Indice |
[modifica]Parametri
(Nessuno)
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.
[modifica]Valore di ritorno
Se good()==true, restituisce il carattere successivo come ottenuta 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.
In caso contrario, restituisce 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.
[modifica]Esempio
#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';}
Output:
Peeked: H got: H
[modifica]Vedi anche
estratti di caratteri Original: extracts characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
unextracts un carattere 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. (metodo pubblico) |