std::basic_istream::ignore
Aus cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> basic_istream& ignore( std::streamsize count = 1, int_type delim = Traits::eof() ); |
||
Auszüge und verwirft Zeichen aus dem Eingabe-Stream bis einschließlich
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.
Verhält sich wie
UnformattedInputFunction. Nach dem Bau und Prüfung der Schildwache Objekts, extrahiert Zeichen aus dem Stream und verwirft sie, bis eine der folgenden Bedingungen erfüllt ist: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.
countZeichen extrahiert wurden (dieser Test ist in dem speziellen Fall deaktiviert, wenncountstd::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.
- Ende der Datei Bedingungen auftritt in der Eingangssequenz (in diesem Fall die Funktion aufruft
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.
- Das nächste verfügbare Zeichen
cin der Eingangssequenz ist gleichdelimwie durchTraits::eq_int_type(Traits::to_int_type(c), delim)bestimmt. Das Trennzeichen extrahiert und verworfen (dieser Test wird gesperrt, wenndelimwirdTraits::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.
Parameter
| count | - | Anzahl der Zeichen zu extrahieren
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 | - | Trennzeichen, um die Extraktion bei stoppen. Es wird ebenfalls extrahiert .
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. |
Rückgabewert
*this
Beispiel
#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
Siehe auch
}| Extrahiere Zeichen (öffentliche Elementfunktion) | |
Extrakte Zeichen, bis die gegebene Zeichen gefunden wird 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. (öffentliche Elementfunktion) | |