std::basic_istream::ignore
Da cppreference.com.
|
|
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. |
<metanoindex/>
<tbody> </tbody> basic_istream& ignore( std::streamsize count = 1, int_type delim = Traits::eof() ); |
||
Estratti e scarta caratteri dal flusso di input fino e compreso
delim.Original:
Extracts and discards characters from the input stream until and including
delim.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.
Si comporta come
UnformattedInputFunction. Dopo la costruzione e la verifica dell'oggetto sentinella, estrae i caratteri dal flusso e scarta loro fino a quando una delle seguenti condizioni:Original:
Behaves as
UnformattedInputFunction. After constructing and checking the sentry object, extracts characters from the stream and discards them until any one of the following conditions occurs: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.
- Caratteri
countstati estratti (questo test è disattivato nel caso particolare in cuicountugualestd::numeric_limits<std::streamsize>::max()Original:countcharacters were extracted (this test is disabled in the special case whencountequalsstd::numeric_limits<std::streamsize>::max()The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- Fine condizioni file avviene nella sequenza di input (nel qual caso la funzione chiama
setstate(eofbit)Original:end of file conditions occurs in the input sequence (in which case the function callssetstate(eofbit)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cil successivo carattere disponibile nella sequenza di input èdelimcome determinato daTraits::eq_int_type(Traits::to_int_type(c), delim). Il carattere di delimitazione viene estratto ed eliminato (questo test è disabilitata se èdelimTraits::eof())Original:the next available charactercin the input sequence isdelimas determined byTraits::eq_int_type(Traits::to_int_type(c), delim). The delimiter character is extracted and discarded (this test is disabled ifdelimisTraits::eof())The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Parametri
| count | - | numero di caratteri da estrarre
Original: number of characters to extract The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| delim | - | delimitando carattere per fermare l'estrazione a. È anche estratto .
Original: delimiting character to stop the extraction at. It is also extracted. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Valore di ritorno
*this
Esempio
#include <iostream>
#include <sstream>
#include <limits>
int main()
{
std::istringstream input("1\n"
"some non-numeric input\n"
"2\n");
for(;;) {
int n;
input >> n;
if(input.eof() || input.bad())
break;
else if(input.fail()) {
input.clear(); // unset failbit
input.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // skip bad input
} else
std::cout << n << '\n';
}
}
Output:
1
2
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) | |
caratteri estratti fino a quando il carattere dato è stato trovato Original: extracts characters until the given character is found The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |