14.9 FILES AND STREAM CLASSES
C++ practices what it preaches. Since it advocates inheritance, it supports nice hierarchy of classes for supporting input output operations using files.
Files are treated like streams during program execution. A stream is a general name given to a flow of data. Each stream has a source and a destination. For output stream, the source is always memory variable and the destination is the file in which the data is to be written. For input stream, it is the reverse. Each stream is associated with a particular class which contains member functions and definitions for dealing with the particular kind of data flow. For example, ifstream class is associated with disk files used as input. Thus, each file in C++ program is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access