The GNU C++ Iostream Library



Chapter 4: Classes for Files and Strings

There are two very common special cases of input and output: using files, and using strings in memory.

libio defines four specialized classes for these cases:

ifstream
Methods for reading files.
ofstream
Methods for writing files.
istrstream
Methods for reading strings from memory.
ostrstream
Methods for writing strings in memory.

  • Files Reading and writing files.
  • Strings Reading and writing strings in memory.


  • Translated 02/24/96 by Rance Necaise. Original texi file by Bothner and Pesch.