std::basic_istream::ignore
De cppreference.com.
< cpp | io | basic istream
|
|
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. |
| basic_istream& ignore( std::streamsize count = 1, int_type delim = Traits::eof() ); |
||
Extraits et les personnages les rejets à partir du flux d'entrée jusqu'à et y compris
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.
Se comporte comme
UnformattedInputFunction. Après la construction et la vérification de l'objet sentinelle, extrait les caractères à partir du flux et les supprime jusqu'à l'une des conditions suivantes est remplie: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.
-
countcaractères ont été extraits (ce test est désactivé dans le cas particulier oùcountégale std::numeric_limits<std::streamsize>::max()Original:countcharacters were extracted (this test is disabled in the special case whencountequals std::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.
- Fin de fichier se produit dans les conditions de la séquence d'entrée (dans ce cas, la fonction appelle setstate(eofbit)Original:end of file conditions occurs in the input sequence (in which case the function calls setstate(eofbit)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- la
ccaractère suivant disponible dans la séquence d'entrée est déterminé pardelimTraits::eq_int_type(Traits::to_int_type(c), delim). Le caractère délimiteur est extrait et mis au rebut (ce test est désactivée sidelimest Traits::eof())Original:the next available charactercin the input sequence isdelimas determined by Traits::eq_int_type(Traits::to_int_type(c), delim). The delimiter character is extracted and discarded (this test is disabled ifdelimis Traits::eof())The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Sommaire |
[modifier] Paramètres
| count | - | nombre de caractères à extraire
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 | - | délimitant caractère d'arrêter l'extraction à. Il est également extraite .
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. |
[modifier] Retourne la valeur
*this
[modifier] Exemple
#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'; } }
Résultat :
1 2
[modifier] Voir aussi
| extraits caractères 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. (fonction membre publique) | |
| caractères extraits jusqu'à ce que le caractère donné se trouve 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. (fonction membre publique) | |