std::basic_ios<CharT,Traits>::exceptions - cppreference.com
提供: cppreference.com
<tbody> </tbody>
|
|
(1) | |
|
|
(2) | |
ストリームの例外マスクを取得および設定します。 例外マスクは、どのエラー状態の発生時にストリームが failure 型の例外を投げるかを決定します。
1) 例外マスクを返します。
2) 例外マスクを except に設定します。
引数
戻り値
1) 現在の例外マスク。
2) (なし)
ノート
例
#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 } }