27 Input/output library [input.output]

27.5 Iostreams base classes [iostreams.base]

27.5.3 Class ios_base [ios.base]

27.5.3.1 Types [ios.types]

27.5.3.1.1 Class ios_base::failure [ios::failure]

namespace std {
  class ios_base::failure : public system_error {
  public:
    explicit failure(const string& msg, const error_code& ec = io_errc::stream);
    explicit failure(const char* msg, const error_code& ec = io_errc::stream);
  };
}

The class failure defines the base class for the types of all objects thrown as exceptions, by functions in the iostreams library, to report errors detected during stream buffer operations.

When throwing ios_base::failure exceptions, implementations should provide values of ec that identify the specific reason for the failure. [ Note: Errors arising from the operating system would typically be reported as system_category() errors with an error value of the error number reported by the operating system. Errors arising from within the stream library would typically be reported as error_code(io_errc::stream, iostream_category()).  — end note ]

explicit failure(const string& msg, const error_code& ec = io_errc::stream);

Effects: Constructs an object of class failure by constructing the base class with msg and ec.

explicit failure(const char* msg, const error_code& ec = io_errc::stream);

Effects: Constructs an object of class failure by constructing the base class with msg and ec.