Share 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

Reference

basic_ios Class

iostream Programming

iostreams Conventions

Other Resources

basic_ios Members