Streams and File I/O

  1. C++ uses streams to handle I/O.

  2. A stream is a flow of characters.

  3. It is called an input stream if the flow is into the program, and is called an output stream if the flow is out of the program.

  4. If an input stream flows from the keyboard or a file, the program is taking input from the keyboard or file. If an output stream flows to the screen or a file, the program is sending output to the screen or file.

  5. It turns out that cin is an input stream connected to the keyboard, and cout is an output stream connected to the screen. These objects are defined in the header file iostream.