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 11. C I/O Library Functions

The old-style C I/O functions (printf, fprintf, and so on) comprise another area of the library supported for backward compatibility. If you have a choice, you should use the C++ I/O stream classes and objects such as cin and cout to perform input and output. The advantages of the latter are that they have greater flexibility and ease of use; in particular, you can extend your own classes to work with them. They also work more smoothly with the C++ Standard Template Library (STL) string class.

printf, scanf, fprintf, and other old-style C I/O functions support a fixed set of format specifiers that cannot be extended to work with classes and do not work directly with the string class.

For these reasons, I definitely ...

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