30 Input/output library [input.output]

30.1 General [input.output.general]

This Clause describes components that C++ programs may use to perform input/output operations.

The following subclauses describe requirements for stream parameters, and components for forward declarations of iostreams, predefined iostreams objects, base iostreams classes, stream buffering, stream formatting and manipulators, string streams, and file streams, as summarized in Table 106.

Table 106 — Input/output library summary
Subclause Header(s)
[iostreams.requirements] Requirements
[iostream.forward] Forward declarations <iosfwd>
[iostream.objects] Standard iostream objects <iostream>
[iostreams.base] Iostreams base classes <ios>
[stream.buffers] Stream buffers <streambuf>
[iostream.format] Formatting and manipulators <istream>
<ostream>
<iomanip>
[string.streams] String streams <sstream>
[file.streams] File streams <fstream>
[filesystems] File systems <filesystem>
[c.files] C library files <cstdio>
<cinttypes>

Figure [fig:streampos] illustrates relationships among various types described in this clause. A line from A to B indicates that A is an alias (e.g. a typedef) for B or that A is defined in terms of B.

figstreampos traits_pos_type_char char_traits<char> ::pos_type streampos streampos traits_pos_type_char->streampos iostreams.limits.pos traits_pos_type_wchar_t char_traits<wchar_t> ::pos_type wstreampos wstreampos traits_pos_type_wchar_t->wstreampos iostreams.limits.pos fpos fpos<mbstate_t> streampos->fpos iostream.forward wstreampos->fpos iostream.forward traits_off_type_char char_traits<char> ::off_type streamoff streamoff traits_off_type_char->streamoff iostreams.limits.pos traits_off_type_wchar_t char_traits<wchar_t> ::off_type traits_off_type_wchar_t->streamoff iostreams.limits.pos streamoff_type signed integer type sufficient for O/S maximum file size streamoff->streamoff_type stream.types streamsize streamsize streamsize_type signed integer type represents characters xfered or buffer sizes streamsize->streamsize_type stream.types
Figure 7 — Stream position, offset, and size types [non-normative]