# I/O

## Classes

- class std::basic_filebuf< _CharT, _Traits >
    The actual work of input and output (for files).

    This class associates both its input and output sequence with an external disk file, and maintains a joint file position for both sequences. Many of its semantics are described in terms of similar behavior in the Standard C Library's `FILE` streams. More...

- class std::basic_fstream< _CharT, _Traits >
    Controlling input and output for files.

    This class supports reading from and writing to named files, using the inherited functions from std::basic_iostream. To control the associated sequence, an instance of std::basic_filebuf is used, which this page refers to as `sb`. More...

- class std::basic_ifstream< _CharT, _Traits >
    Controlling input for files.

    This class supports reading from named files, using the inherited functions from std::basic_istream. To control the associated sequence, an instance of std::basic_filebuf is used, which this page refers to as `sb`. More...

- class std::basic_ios< _CharT, _Traits >
    Virtual base class for all stream classes.

    Most of the member functions called dispatched on stream objects (e.g., `std::cout.foo(bar)`;) are consolidated in this class. More...

- class std::basic_iostream< _CharT, _Traits >
    Merging istream and ostream capabilities.

    This class multiply inherits from the input and output stream classes simply to provide a single interface. More...

- class std::basic_istream< _CharT, _Traits >
    Controlling input.

    This is the base class for all input streams. It provides text formatting of all builtin types, and communicates with any class derived from basic_streambuf to do the actual input. More...

- class std::basic_istringstream< _CharT, _Traits, _Alloc >
    Controlling input for std::string.

    This class supports reading from objects of type std::basic_string, using the inherited functions from std::basic_istream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as `sb`. More...

- class std::basic_ofstream< _CharT, _Traits >
    Controlling output for files.

    This class supports reading from named files, using the inherited functions from std::basic_ostream. To control the associated sequence, an instance of std::basic_filebuf is used, which this page refers to as `sb`. More...

- class std::basic_ostream< _CharT, _Traits >
    Controlling output.

    This is the base class for all output streams. It provides text formatting of all builtin types, and communicates with any class derived from basic_streambuf to do the actual output. More...

- class std::basic_ostringstream< _CharT, _Traits, _Alloc >
    Controlling output for std::string.

    This class supports writing to objects of type std::basic_string, using the inherited functions from std::basic_ostream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as `sb`. More...

- class std::basic_stringbuf< _CharT, _Traits, _Alloc >
    The actual work of input and output (for std::string).

    This class associates either or both of its input and output sequences with a sequence of characters, which can be initialized from, or made available as, a `std::basic_string`. (Paraphrased from [27.7.1]/1.). More...

- class std::basic_stringstream< _CharT, _Traits, _Alloc >
    Controlling input and output for std::string.

    This class supports reading from and writing to objects of type std::basic_string, using the inherited functions from std::basic_iostream. To control the associated sequence, an instance of std::basic_stringbuf is used, which this page refers to as `sb`. More...

- class std::ios_base
    The base of the I/O class hierarchy.

    This class defines everything that can be defined about I/O that does not depend on the type of characters being input or output. Most people will only see `ios_base` when they need to specify the full name of the various I/O flags (e.g., the openmodes). More...

## Typedefs

- typedef basic_filebuf< char > std::filebuf
- typedef basic_fstream< char > std::fstream
- typedef basic_ifstream< char > std::ifstream
- typedef basic_ios< char > std::ios
- typedef basic_iostream< char > std::iostream
- typedef basic_istream< char > std::istream
- typedef basic_istringstream< char > std::istringstream
- typedef basic_ofstream< char > std::ofstream
- typedef basic_ostream< char > std::ostream
- typedef basic_ostringstream< char > std::ostringstream
- typedef basic_streambuf< char > std::streambuf
- typedef basic_stringbuf< char > std::stringbuf
- typedef basic_stringstream< char > std::stringstream
- typedef basic_filebuf< wchar_t > std::wfilebuf
- typedef basic_fstream< wchar_t > std::wfstream
- typedef basic_ifstream< wchar_t > std::wifstream
- typedef basic_ios< wchar_t > std::wios
- typedef basic_iostream< wchar_t > std::wiostream
- typedef basic_istream< wchar_t > std::wistream
- typedef basic_istringstream
  < wchar_t > std::wistringstream
- typedef basic_ofstream< wchar_t > std::wofstream
- typedef basic_ostream< wchar_t > std::wostream
- typedef basic_ostringstream
  < wchar_t > std::wostringstream
- typedef basic_streambuf< wchar_t > std::wstreambuf
- typedef basic_stringbuf< wchar_t > std::wstringbuf
- typedef basic_stringstream
  < wchar_t > std::wstringstream

## Detailed Description

Nearly all of the I/O classes are parameterized on the type of characters they read and write. (The major exception is ios_base at the top of the hierarchy.) This is a change from pre-Standard streams, which were not templates.

For ease of use and compatibility, all of the basic_* I/O-related classes are given typedef names for both of the builtin character widths (wide and narrow). The typedefs are the same as the pre-Standard names, for example:

         typedef basic_ifstream<char>  ifstream;

Because properly forward-declaring these classes can be difficult, you should not do it yourself. Instead, include the <iosfwd> header, which contains only declarations of all the I/O classes as well as the typedefs. Trying to forward-declare the typedefs themselves (e.g., "class ostream;") is not valid ISO C++.

For more specific declarations, see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch24.html

## Typedef Documentation

typedef basic_filebuf<char> std::filebuf

One of the I/O .

Definition at line 136 of file iosfwd.

typedef basic_fstream<char> std::fstream

One of the I/O .

Definition at line 139 of file iosfwd.

typedef basic_ifstream<char> std::ifstream

One of the I/O .

Definition at line 137 of file iosfwd.

typedef basic_ios<char> std::ios

One of the I/O .

Definition at line 127 of file iosfwd.

typedef basic_iostream<char> std::iostream

One of the I/O .

Definition at line 131 of file iosfwd.

typedef basic_istream<char> std::istream

One of the I/O .

Definition at line 129 of file iosfwd.

typedef basic_istringstream<char> std::istringstream

One of the I/O .

Definition at line 133 of file iosfwd.

typedef basic_ofstream<char> std::ofstream

One of the I/O .

Definition at line 138 of file iosfwd.

typedef basic_ostream<char> std::ostream

One of the I/O .

Definition at line 130 of file iosfwd.

typedef basic_ostringstream<char> std::ostringstream

One of the I/O .

Definition at line 134 of file iosfwd.

typedef basic_streambuf<char> std::streambuf

One of the I/O .

Definition at line 128 of file iosfwd.

typedef basic_stringbuf<char> std::stringbuf

One of the I/O .

Definition at line 132 of file iosfwd.

typedef basic_stringstream<char> std::stringstream

One of the I/O .

Definition at line 135 of file iosfwd.

typedef basic_filebuf<wchar_t> std::wfilebuf

One of the I/O .

Definition at line 151 of file iosfwd.

typedef basic_fstream<wchar_t> std::wfstream

One of the I/O .

Definition at line 154 of file iosfwd.

typedef basic_ifstream<wchar_t> std::wifstream

One of the I/O .

Definition at line 152 of file iosfwd.

typedef basic_ios<wchar_t> std::wios

One of the I/O .

Definition at line 142 of file iosfwd.

typedef basic_iostream<wchar_t> std::wiostream

One of the I/O .

Definition at line 146 of file iosfwd.

typedef basic_istream<wchar_t> std::wistream

One of the I/O .

Definition at line 144 of file iosfwd.

typedef basic_istringstream<wchar_t> std::wistringstream

One of the I/O .

Definition at line 148 of file iosfwd.

typedef basic_ofstream<wchar_t> std::wofstream

One of the I/O .

Definition at line 153 of file iosfwd.

typedef basic_ostream<wchar_t> std::wostream

One of the I/O .

Definition at line 145 of file iosfwd.

typedef basic_ostringstream<wchar_t> std::wostringstream

One of the I/O .

Definition at line 149 of file iosfwd.

typedef basic_streambuf<wchar_t> std::wstreambuf

One of the I/O .

Definition at line 143 of file iosfwd.

typedef basic_stringbuf<wchar_t> std::wstringbuf

One of the I/O .

Definition at line 147 of file iosfwd.

typedef basic_stringstream<wchar_t> std::wstringstream

One of the I/O .

Definition at line 150 of file iosfwd.