14.2. Files and Streams
C++ views each file simply as a sequence of bytes (Fig. 14.1). Each file ends either with an end-of-file marker or at a specific byte number recorded in an operating-system-maintained, administrative data structure. When a file is opened, an object is created, and a stream is associated with the object. In Chapter 13, we saw that objects
clog are created when
<iostream> is included. The streams associated with these objects provide communication channels between a program and a particular file or device. For example, the
cin object (standard input stream object) enables a program to input data from the keyboard or from other devices, the
cout object (standard output stream object) enables a program ...