Testing the State of an
I/O Stream
C++ provides a way to check whether a stream is in the fail
state. You simply use the name of the stream object as if it
were a Boolean variable.