From cppreference.com
Defined in header
enumclassio_errc{stream=1,};(since C++11)The scoped enumeration std::io_errc defines the error codes reported by I/O streams in
exception objects. Only one error code (std::io_errc::stream) is required, although the implementation may define additional error codes. Because the appropriate specialization of
is provided, values of type std::io_errc are implicitly convertible to
.
Member constants
Enumeration constant Value stream1Non-member functions
Helper classes
Example
Run this code
#include<fstream>#include<iostream>intmain(){std::ifstreamf("doesn't exist");try{f.exceptions(f.failbit);}catch(conststd::ios_base::failure&e){std::cout<<"Caught an ios_base::failure.\n";if(e.code()==std::io_errc::stream)std::cout<<"The error code is std::io_errc::stream\n";}}Output:
Caught an ios_base::failure. The error code is std::io_errc::stream See also