October 1997
Intermediate to advanced
800 pages
20h 48m
English
In “Type-Safe I/O” on page 55, you learned the basics for performing input (extraction) and output (insertion). The insertion operator (<<) inserts bytes into an output stream, such as cout (standard output) or cerr (standard error). Similarly, the extraction operator (>>) extracts bytes from an input stream, such as cin (standard input). The task of the IOStream library is to convert streams of bytes from an input stream into data that is consistent with its argument type. The IOStream library also converts the binary representation of a data value into bytes for an output stream. Thus, if i is an integer, the statement
cin >> i;
converts bytes from istream cin into an integer value. Likewise, the statement
cout << ...