how do i use ios::fail()?

Hi,

could anyone tell me how to use iso::fail, i mean the syntax. I searched, but I couldn't see any sample code.

Below is my code, which is obviously faulty one, and the corresponding error message.

1
2
3
4
5
6
 
      char b[102];     
      in.getline(b, 102);

      if( ios_base::in.fail() )
             throw(100);




BigNum.c++:92: error: request for member ‘fail’ in ‘std::ios_base::in’, which is of non-class type ‘const std::_Ios_Openmode’

Just use in.fail(). There is no need for the "ios_base::" as with it you are basically saying access const member in, and call the fail() method, which is incorrect.
Topic archived. No new replies allowed.