O'Reilly logo

C++ for the Impatient by Brian Overland

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

Chapter 13. C++ I/O Stream Classes

One of the first innovations introduced in C++ was the use of stream classes and objects to perform input and output. These classes replace the old C-language functions printf, scanf, and so on. The latter are still supported for backward compatibility, but the more objected-oriented approach—using cin, cout, and the stream classes—offers many advantages.

Not only are the stream classes easier to use than C I/O functions, but they are also more extensible. By overloading the stream I/O operators, for example, you can make stream objects work smoothly with any types.

Another advantage is that all the operations and functions used for console input/output work exactly the same way with file objects and strings: ...

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