std::basic_ios<CharT,Traits>::good

From cppreference.com
< cpp‎ | io‎ | basic ios
 
 
Input/output library
I/O manipulators
C-style I/O
Buffers
(deprecated in C++98)
Streams
Abstractions
File I/O
String I/O
Array I/O
(deprecated in C++98)
(deprecated in C++98)
(deprecated in C++98)
Synchronized Output
Types
Error category interface
(C++11)
 
 
bool good() const;

Returns true if the the most recent I/O operation on the stream completed successfully. Specifically, returns result of rdstate() == 0.

See ios_base::iostate for the list of conditions that set the stream status bits.

Parameters

(none)

Return value

true if the stream has no errors occurred, false otherwise.

Example

See also

The following table shows the value of basic_ios accessors (good(), fail(), etc.) for all possible combinations of ios_base::iostate flags:

ios_base::iostate flags basic_ios accessors
eofbit failbit badbit good() fail() bad() eof() operator bool operator!
false false false true false false false true false
false false true false true true false false true
false true false false true false false false true
false true true false true true false false true
true false false false false false true true false
true false true false true true true false true
true true false false true false true false true
true true true false true true true false true