Sets the stream to throw exceptions instead of silently ignoring the error conditions specified. Without parameters returns the current setting.

The setting is composed by ORing together bits for the conditions to throw on. The following code enables all exceptions on stream s.

   s.exceptions(std::ios::badbit | std::ios::failbit | std::ios::eofbit);

Related Topics: bad, clear, eof, fail, good, rdstate

Stream states: