When doing stream I/O, some unpredictable situations can occur at
runtime. Binary streams are no exception to this phenomenon. To
provide some sort of protection against this, all libbinio classes
inherit an error reporting method called
It is a good idea to check the error status of a stream once in a
while to see if everything is still in place.
error() returns a
variable of type
Error, which holds the actual error value for
you to check. Refer to Reference for information about the
possible values of this variable and their meaning.
A status of no error is always reported with a value of
you can easily check if everything is still okay in a simple
construct, like this:
if(mystream.error()) // an error occured, do something to cure it... else // everything is still okay!
One convenience error reporting method is also included, that only
checks for the
Eof error status, indicating whether the end of
the stream has already been reached. It is simply called
and returns a boolean value, indicating the end of the stream.
Whenever you call one of the
the internal error variable is reset to the "no error" state and a
subsequent call to one of these methods will return