Chapter 16. INPUT, OUTPUT, AND FILES

You will learn about the following in this chapter:

  • The C++ view of input and output

  • The iostream family of classes

  • Redirection

  • ostream class methods

  • Formatting output

  • istream class methods

  • Stream states

  • File I/O

  • Using the ifstream class for input from files

  • Using the ofstream class for output to files

  • Using the fstream class file input and output

  • Command-line processing

  • Binary files

  • Random file access

  • Incore formatting

Discussing C++ input and output (I/O, for short) poses a problem. On the one hand, practically every program uses input and output, and learning how to use them is one of the first tasks facing someone learning a computer language. On the other hand, C++ uses many of its more advanced language features ...

Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.