std::basic_istream::putback
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. |
basic_istream& putback( char_type ch ); |
||
Inserisce il carattere
ch
torna il flusso di input in modo che il carattere successivo estratto sarà ch
. Original:
Puts the character
ch
back to the input stream so the next extracted character will be ch
. 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 primo luogo cancella
eofbit
, quindi si comporta come UnformattedInputFunction
. Dopo la costruzione e la verifica dell'oggetto sentinella, se rdbuf()
non è nullo, chiama rdbuf()->sputbackc(ch), che chiama rdbuf()->pbackfail(ch) ch
se non è uguale al personaggio più recente estratto.Original:
First clears
eofbit
, then behaves as UnformattedInputFunction
. After constructing and checking the sentry object, if rdbuf()
is not null, calls rdbuf()->sputbackc(ch), which calls rdbuf()->pbackfail(ch) if ch
does not equal the most recently extracted character.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.
Se
rdbuf()
è null o se rdbuf->sputbackc(ch) ritorna Traits::eof(), chiama setstate(badbit).Original:
If
rdbuf()
is null or if rdbuf->sputbackc(ch) returns Traits::eof(), calls setstate(badbit).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 ogni caso, imposta il contatore a zero
gcount()
.Original:
In any case, sets the
gcount()
counter to zero.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
*this
[modifica] Esempio
illustra la differenza tra la modifica e non modifica putback ()
Original:
demonstrates the difference between modifying and non-modifying putback()
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.
#include <sstream> #include <iostream> int main() { std::stringstream s1("Hello, world"); // IO stream s1.get(); if(s1.putback('Y')) // modifies the buffer std::cout << s1.rdbuf() << '\n'; else std::cout << "putback failed\n"; std::istringstream s2("Hello, world"); // input-only stream s2.get(); if(s2.putback('Y')) // cannot modify input-only buffer std::cout << s2.rdbuf() << '\n'; else std::cout << "putback failed\n"; s2.clear(); if(s2.putback('H')) // non-modifying putback std::cout << s2.rdbuf() << '\n'; else std::cout << "putback failed\n"; }
Output:
Yello, world putback failed Hello, world
[modifica] Vedi anche
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) | |
legge il carattere successivo senza estrarlo Original: reads the next character 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. (metodo pubblico) |