Input/Output Streams
An iostream object is a source and/or a destination for bytes. The two most important I/O stream classes, both derived from iostream, are fstream and strstream. These classes inherit the functionality of the istream and ostream classes described previously.
The fstream class supports disk file input and output. If you need to read from and write to a particular disk file in the same program, construct an fstream object. An fstream object is a single stream with two logical substreams, one for input and one for output. Although the underlying buffer contains separately designated positions for reading and writing, those positions are tied together.
The strstream class supports input and output of in-memory strings.