Table of Contents

C++ Input/output library

https://en.cppreference.com/w/cpp/io

C++ includes two input/output libraries: an Object-oriented_programming | OOP-style stream-based I/O library 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 (

and

). The classes are organized into the following hierarchy:

Typedefs

The following typedefs for common character types are provided:

Predefined standard stream objects

[[cpp/io/manip]] | [[I/O Manipulators]]

The stream-based I/O library uses cpp/io/manip | I/O manipulators (e.g.

,

, etc.) to control how streams behave.

Types

The following auxiliary types are defined:

The following typedef names for

are provided:

]] | {{c | state_type>}}}} {{dsc | {{tt | wstreampos}} | {{c | state_type>}}}} {{dsc | {{tt | u8streampos}} {{mark c++20}} | {{c | state_type>}}}} {{dsc | {{tt | u16streampos}} {{mark c++11}} | {{c | state_type>}}}} {{dsc | {{tt | u32streampos}} {{mark c++11}} | {{c | state_type>}}}} {{dsc end}} ====Error category interface==== {{dsc begin}} {{dsc header | ios}} {{dsc inc | cpp/io/dsc io_errc}} {{dsc inc | cpp/io/dsc iostream_category}} {{dsc end}} ===[[cpp/io/c | C-style I/O

C++ also includes the cpp/io/c | input/output functions defined by C, such as

,

, etc.