Chapter 14. Study Guide

File input and output (I/O) aren't glamorous parts of computer programming, but they are fundamental and therefore important. Contemporary C++ programs replace many file I/O operations with database or GUI operations. Nevertheless, these high-level operations rest on C++'s lower-level I/O operations and on an OS's low-level operations. Without file I/O operations, programs can only process and produce limited amounts of data. The large number of C++ API classes and functions, coupled with their numerous options, exacerbates the situation, making learning how to use language-specific documentation essential.

The C++ API also provides classes combining the behaviors of I/O streams and strings (C-strings and instances of the string class). These string streams support advanced data input validation, data type conversions, data extraction or parsing operations, and formatting and accumulating output. Programmers frequently use regular expressions (RE) to validate user input, either through the console or GUI features. The chapter introduces and demonstrates string streams and regular expressions at the end.

It's convenient to think of data moving between a file and a program as a stream or sequence of bytes. Hence, the C++ objects that perform I/O operations are called stream objects or simply streams. We'll organize the C++ I/O features in four ways to help manage their complexity:

Know

Know about less common features