I have the following that will open a file for reading. However, I want to check to make sure that the file was open successfully, so I am using the fail to see if the flags
You have to call fail() on the stream object. A more idiomatic way of doing this is:
input_stream.open(_file_name.c_str(), ios::in); if( ! input_stream ) { return -1; }