Partager via


basic_ios::clear

Clears all error flags.

void clear(
      iostate _State=goodbit,
    bool _Reraise = false
);
void clear(
        io_state _State
);

Parameters

  • _State (optional)
    The flags you want to set after clearing all flags.

  • _Reraise
    Specifies whether the exception should be re-raised.

Remarks

The flags are goodbit, failbit, eofbit, and badbit. Test for these flags with good, bad, eof, and fail

The member function replaces the stored stream state information with

_State | (rdbuf != 0 ? goodbit : badbit)

If _State &exceptions is nonzero, it then throws an object of class failure.

Example

See rdstate for an example of using clear.

Requirements

Header: <ios>

Namespace: std

See Also

Concepts

basic_ios Class

basic_ios Members

iostream Programming

iostreams Conventions