O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A.2. IOStream Overview

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 << ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required