Espaces de noms
Variantes
Affichages
Actions

cpp/io/basic ios/exceptions

De cppreference.com
< cpp‎ | io‎ | basic ios

std::ios_base::iostate exceptions() const;
void exceptions(std::ios_base::iostate except);

[modifier] Paramètres

except -
masque d'exception
Original:
exception mask
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier] Exemple

#include <iostream>
#include <fstream>
 
int main() {
    int ivalue;
    try {
        std::ifstream in("in.txt");
        in.exceptions(std::ifstream::failbit);
        in >> ivalue;
    } catch (std::ios_base::failure &fail) {
        // handle exception here
    }
}