basic_ios::fail

Indicates failure to extract a valid field from a stream.

bool fail( ) const;

Return Value

true if rdstate & (badbit|failbit) is nonzero, otherwise false.

For more information on failbit, see ios_base::iostate.

Example

// basic_ios_fail.cpp
// compile with: /EHsc
#include <iostream>

int main( void ) 
{
   using namespace std;
   bool b = cout.fail( );
   cout << boolalpha;
   cout << b << endl;
}

Output

false

Requirements

Header: <ios>

Namespace: std

See Also

Reference

basic_ios Class

iostream Programming

iostreams Conventions