August 2012
Intermediate to advanced
976 pages
30h 17m
English
Inherent in doing IO is the fact that errors can occur. Some errors are recoverable; others occur deep within the system and are beyond the scope of a program to correct. The IO classes define functions and flags, listed in Table 8.2, that let us access and manipulate the condition state of a stream.
Table 8.2. IO Library Condition State
As an example of an IO error, consider the following code:
int ival;cin >> ival;
If we enter Boo on the standard input, the read will fail. The input operator expected to read an int but got the character B instead. As a result, cin will be put in an error state. Similarly, cin will be ...
Read now
Unlock full access