=====Input/output library=====
Standard input/output library is organized in such a way that the underlying device of an input/output operation is abstracted. In this way the same code can handle input/output to a file, memory stream, or custom adaptor device interpreting the data on the fly, e.g. compressing it. Most of the classes are templated, so they can be adapted to any basic character type. Separate typedefs are provided for the most common basic character types (''char'' and ''wchar_t'').
The library consists of the following elements:\\
* **Abstraction**:\\
* raw device abstraction class :\\
''[[/io/basic_streambuf/]]''\\
* classes that act as a wrapper for a given abstract device and provide high level input/output interface:\\
''[[/io/basic_istream/]]'' (input stream)\\
''[[/io/basic_ostream/]]'' (output stream)\\
''[[/io/basic_iostream/]]'' (input/output stream)\\
These classes internally inherit several utility classes:\\
''[[/io/ios_base/]]''\\
''[[/io/basic_ios/]]''\\
* **Implementation**:\\
* file based streams:\\
''[[/io/basic_filebuf/]]'' (raw file device implementation) \\
''[[/io/basic_ifstream/]]'' (input file stream)\\
''[[/io/basic_ofstream/]]'' (output file stream)\\
''[[/io/basic_fstream/]]'' (input-output file stream)\\
* string based streams:\\
''[[/io/basic_stringbuf/]]'' (raw string device implementation) \\
''[[/io/basic_istringstream/]]'' (input string stream)\\
''[[/io/basic_ostringstream/]]'' (output string stream)\\
''[[/io/basic_stringstream/]]'' (input-output string stream)\\
====Abstractions====
==Raw device==
The interface with underlying raw device is abstracted by abstract class template ''**[[/io/basic_streambuf/]]**''. This class is not meant to be copyable: one ''basic_streambuf'' object corresponds to one actual device.
==Device management==
Class template ''**[[/io/basic_ios/]]**'' manages an object that implements ''[[/io/basic_streambuf/]]'' interface. Several ''basic_ios'' objects can refer to one actual ''basic_streambuf'' object. ''basic_ios'' stores error and formatting flags. A lot of this functionality is placed in ''**[[/io/ios_base/]]**'' base class.
==Streams==
The class templates ''**[[/io/basic_istream/]]**'', ''**[[/io/basic_ostream/]]**'' and ''**[[/io/basic_iostream/]]**'' provide high level input/output capabilities such as sequential reading/writing as well as formatting. These classes all implement that functionality over interface, provided by the ''basic_streambuf'' class. It is accessed through ''basic_ios'' class, which ''basic_istream'', ''basic_ostream'' and ''basic_iostream'' inherit. The capabilities of these classes are as follows:
* ''[[/io/basic_istream/]]'' allows input operations
* ''[[/io/basic_ostream/]]'' allows output operations
* ''[[/io/basic_iostream/]]'' allows both input and output operations
====Implementations====
==Raw devices==
Two classes that implements the ''[[/io/basic_streambuf/]]'' interface are provided:
* class template ''**[[/io/basic_filebuf/]]**'' implements file based device
* class template ''**[[/io/basic_filebuf/]]**'' implements memory (''[[/string/basic_string/]]'') based device.
==Streams==
Three class templates pair ''basic_istream'', ''basic_ostream'' and ''basic_iostream'' with ''basic_filebuf'':
* class template ''**[[/io/basic_ifstream/]]**'' provides support for file input operations.
* class template ''**[[/io/basic_ofstream/]]**'' provides support for file output operations.
* class template ''**[[/io/basic_fstream/]]**'' provides support for both file input and output operations.
Three class templates pair ''basic_istream'', ''basic_ostream'' and ''basic_iostream'' with ''basic_stringbuf'':
* class template ''**[[/io/basic_istringstream/]]**'' provides support for memory-based input operations.
* class template ''**[[/io/basic_ostringstream/]]**'' provides support for memory-based output operations.
* class template ''**[[/io/basic_stringstream/]]**'' provides support for both memory-based input and output operations.
====Typedefs====
The following typedefs for common character types are provided:
typedef basic_streambuf streambuf;
typedef basic_streambuf wstreambuf;
typedef basic_filebuf filebuf;
typedef basic_filebuf wfilebuf;
typedef basic_stringbuf stringbuf;
typedef basic_stringbuf wstringbuf;
typedef basic_istream istream;
typedef basic_istream wistream;
typedef basic_ostream ostream;
typedef basic_ostream wostream;
typedef basic_iostream iostream;
typedef basic_iostream wiostream;
typedef basic_ifstream ifstream;
typedef basic_ifstream wifstream;
typedef basic_ofstream ofstream;
typedef basic_ofstream wofstream;
typedef basic_fstream fstream;
typedef basic_fstream wfstream;
typedef basic_istringstream istringstream;
typedef basic_istringstream wistringstream;
typedef basic_ostringstream ostringstream;
typedef basic_ostringstream wostringstream;
typedef basic_stringstream stringstream;
typedef basic_stringstream wstringstream;
Predefined standard stream objects:
extern istream cin; //standard input (stdin)
extern wistream wcin;
extern ostream cout; //standard output (stdout)
extern wostream wcout;
extern ostream cerr; //standard error (stderr)
extern wostream wcerr;
extern ostream clog; //standard log (stdlog)
extern wostream wclog;
====Manipulators====
Several manipulators are defined to control the formatting of input/output operations on streams.
=======
\\ \\
Some of the behavior of the C++ I/O streams (precision, justification,
etc) may be modified by manipulating various [[io/io_flags|I/O stream
format flags]].
|[[exceptions]]|set the stream to throw exceptions on errors|
|[[rdstate]]|returns the state flags of the stream|
====C-style input/output====
[[/io/c/ | C-style input/output]]