template <class charT, class traits> basic_ostream<charT,traits>& operator<< ( basic_ostream<charT,traits>& os, const error_code& ec );
os << ec.category.name() << ':' << ec.value()
12345678910111213141516
// error_code::operator<< #include <iostream> #include <system_error> #include <fstream> int main() { std::ifstream is; is.exceptions (std::ios::failbit); try { is.open ("unexistent.txt"); } catch (std::system_error e) { std::cout << "Exception caught: " << std::endl; std::cout << e.code() << " = " << e.what() << std::endl; } }
Exception caught: iostream:1 = ios_base::failbit set