no copyright!iostream-overview.3

IOStreams

Overview

This page is intended to give a brief overview of the IOStream classes pointing to more specific manual pages for detailed information. It should be useful to find other sources of information relating to IOStreams.

There are some manual pages describing general stuff related to IOStreams:

The Basic class hierarchy of the IOStreams library is made up of a bunch of classes:
  • The class ios_base defining some constants and most character type independent processing (handling of exceptions is also character type independent but found in the class basic_ios).
  • The template class basic_ios which manages the stream's stream buffer and provides operations applying both to input and output.
  • The template class basic_streambuf which handles character buffering and the actual access to the sequence underlying a stream. If you want to create a new stream, have a look at this class!
  • The template class basic_istream which provides operations for formatted and unformatted input.
  • The template class basic_ostream which provides operations for formatted and unformatted output
  • The template class basic_iostream which provides operations for formatted and unformatted input and output.
The C++ standard library provides some classes to access generally useful "external representations":
  • To access files, the stream classes basic_ifstream, basic_ofstream, and basic_fstream are provided. These classes internally use an object of type basic_filebuf to do the actual I/O operations.
  • For in-memory I/O operations using basic_strings as representation, the classes basic_istringstream, basic_ostringstream, and basic_stringstream are provided. These classes internally use an object of type basic_stringbuf to do the actual string manipulations
  • For compatibility with older libraries, there are also classes for in-memory I/O operations using char arrays. The corresponding stream classes are istrstream, ostrstram, and strstream which are all using the class strstreambuf to maintain the char array. The use of these classes is deprecated because they have some severe problems (make sure you read through the corresponding manual pages if you are using one of these classes).

Tutorials

dk:TODO
  • Writing I/O operators
  • Changing the formatting for built-in types
  • Creating new stream classes
  • Defining new manipulators
  • Defining I/O with a new character type
  • stdio vs. IOStreams

Copyright © 1999 Dietmar Kühl, Claas Solutions (dietmar.kuehl@claas-solutions.de)