cpp/io/basic ios/exceptions
Материал из cppreference.com
<tbody>
</tbody>
std::ios_base::iostate exceptions() const; |
||
void exceptions(std::ios_base::iostate except); |
||
Параметры
| except | — | Исключение маски
Оригинал: exception mask Текст был переведён автоматически используя Переводчик Google. Вы можете проверить и исправить перевод. Для инструкций щёлкните сюда. |
Пример
Запустить этот код
#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
}
}