cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : IOstream Library : ios : good
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
IOstream Library
manipulators
classes:
· filebuf
· fstream
· ifstream
· ios
· iostream
· ios_base
· istream
· istringstream
· ofstream
· ostream
· ostringstream
· streambuf
· stringbuf
· stringstream
objects:
· cerr
· cin
· clog
· cout
types:
· fpos
· streamoff
· streampos
· streamsize
ios
· ios::ios
· ios::~ios
member functions:
· ios::bad
· ios::clear
· ios::copyfmt
· ios::eof
· ios::exceptions
· ios::fail
· ios::fill
· ios::good
· ios::imbue
· ios::init
· ios::narrow
· ios::operator!
· ios::operator void*
· ios::rdbuf
· ios::rdstate
· ios::setstate
· ios::tie
· ios::widen

-

ios::good public member function
bool good ( ) const; 

Check if the state of the stream is good for i/o operations.

The function returns true if none of the stream's error flags (eofbit, failbit and badbit) are set.

Notice that this function is not the exact opposite of bad(), which only checks whether the badbit error flag is set.

The error flags can be checked independently by using any of the member functions eof, fail and bad.

The value returned by this function is the same as the result of evaluating:
(rdstate() == 0)

Parameters

none

Return Value

true if none of the stream's state flags are set.
false if any of the stream's state flags are set (badbit, eofbit or failbit).

Basic template member declaration

( basic_ios<charT,traits> )
bool good () const;

See also

ios::fail Check if either failbit or badbit is set (public member function)
ios::bad Check if badbit is set (public member function)
ios::eof Check if eofbit is set (public member function)
ios::rdstate Get error state flags (public member function)
ios::setstate Set error state flag (public member function)
ios::clear Set error state flags (public member function)

© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us