Input/output library
From cppreference.com
< cpp
C++ includes the following input/output libraries: an OOP-style stream-based I/O library, print-based family of functions(since C++23), and the standard set of C-style I/O functions.
Stream-based I/O
The stream-based input/output library is organized around abstract input/output devices. These abstract devices allow the same code to handle input/output to files, memory streams, or custom adaptor devices that perform arbitrary operations (e.g. compression) on the fly.
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 classes are organized into the following hierarchy:
Inheritance diagram
Abstraction | |
Defined in header
<ios> | |
| manages formatting flags and input/output exceptions (class) | |
| manages an arbitrary stream buffer (class template) | |
Defined in header
<streambuf> | |
| abstracts a raw device (class template) | |
Defined in header
<ostream> | |
| wraps a given abstract device (std::basic_streambuf) and provides high-level output interface (class template) | |
Defined in header
<istream> | |
| wraps a given abstract device (std::basic_streambuf) and provides high-level input interface (class template) | |
| wraps a given abstract device (std::basic_streambuf) and provides high-level input/output interface (class template) | |
File I/O implementation | |
Defined in header
<fstream> | |
| implements raw file device (class template) | |
| implements high-level file stream input operations (class template) | |
| implements high-level file stream output operations (class template) | |
| implements high-level file stream input/output operations (class template) | |
String I/O implementation | |
Defined in header
<sstream> | |
| implements raw string device (class template) | |