[ios.base.general]

# 31 Input/output library [[input.output]](./#input.output)

## 31.5 Iostreams base classes [[iostreams.base]](iostreams.base#ios.base.general)

### 31.5.2 Class ios_base [[ios.base]](ios.base#general)

#### 31.5.2.1 General [ios.base.general]

[ð](#lib:ios_base)

namespace std {class ios_base {public:class failure; // see below// [[ios.fmtflags]](ios.fmtflags "31.5.2.2.2 Type ios_­base​::​fmtflags"), fmtflagsusing fmtflags = *T1*; static constexpr fmtflags boolalpha = *unspecified*; static constexpr fmtflags dec = *unspecified*; static constexpr fmtflags fixed = *unspecified*; static constexpr fmtflags hex = *unspecified*; static constexpr fmtflags internal = *unspecified*; static constexpr fmtflags left = *unspecified*; static constexpr fmtflags oct = *unspecified*; static constexpr fmtflags right = *unspecified*; static constexpr fmtflags scientific = *unspecified*; static constexpr fmtflags showbase = *unspecified*; static constexpr fmtflags showpoint = *unspecified*; static constexpr fmtflags showpos = *unspecified*; static constexpr fmtflags skipws = *unspecified*; static constexpr fmtflags unitbuf = *unspecified*; static constexpr fmtflags uppercase = *unspecified*; static constexpr fmtflags adjustfield = *see below*; static constexpr fmtflags basefield = *see below*; static constexpr fmtflags floatfield = *see below*; // [[ios.iostate]](ios.iostate "31.5.2.2.3 Type ios_­base​::​iostate"), iostateusing iostate = *T2*; static constexpr iostate badbit = *unspecified*; static constexpr iostate eofbit = *unspecified*; static constexpr iostate failbit = *unspecified*; static constexpr iostate goodbit = *see below*; // [[ios.openmode]](ios.openmode "31.5.2.2.4 Type ios_­base​::​openmode"), openmodeusing openmode = *T3*; static constexpr openmode app = *unspecified*; static constexpr openmode ate = *unspecified*; static constexpr openmode binary = *unspecified*; static constexpr openmode in = *unspecified*; static constexpr openmode noreplace = *unspecified*; static constexpr openmode out = *unspecified*; static constexpr openmode trunc = *unspecified*; // [[ios.seekdir]](ios.seekdir "31.5.2.2.5 Type ios_­base​::​seekdir"), seekdirusing seekdir = *T4*; static constexpr seekdir beg = *unspecified*; static constexpr seekdir cur = *unspecified*; static constexpr seekdir end = *unspecified*; class Init; // [[fmtflags.state]](fmtflags.state "31.5.2.3 State functions"), fmtflags state fmtflags flags() const;
 fmtflags flags(fmtflags fmtfl);
 fmtflags setf(fmtflags fmtfl);
 fmtflags setf(fmtflags fmtfl, fmtflags mask); void unsetf(fmtflags mask);

 streamsize precision() const;
 streamsize precision(streamsize prec);
 streamsize width() const;
 streamsize width(streamsize wide); // [[ios.base.locales]](ios.base.locales "31.5.2.4 Functions"), locales locale imbue(const locale& loc);
 locale getloc() const; // [[ios.base.storage]](ios.base.storage "31.5.2.6 Storage functions"), storagestatic int xalloc(); long& iword(int idx); void*& pword(int idx); // destructorvirtual ~ios_base(); // [[ios.base.callback]](ios.base.callback "31.5.2.7 Callbacks"), callbacksenum [event](#lib:ios_base,event "31.5.2.1 General [ios.base.general]") { erase_event, imbue_event, copyfmt_event }; using event_callback = void (*)(event, ios_base&, int idx); void register_callback(event_callback fn, int idx);

 ios_base(const ios_base&) = delete;
 ios_base& operator=(const ios_base&) = delete; static bool sync_with_stdio(bool sync = true); protected: ios_base(); private:static int *index*; // *exposition only*long* *iarray*; // *exposition only*void** *parray*; // *exposition only*};}

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L854)

ios_base defines several member types:

- [(1.1)](#1.1)

a type failure, defined as either a class derived fromsystem_error or a synonym for a class derived from system_error;

- [(1.2)](#1.2)

a class Init;

- [(1.3)](#1.3)

three bitmask types, fmtflags, iostate, and openmode;

- [(1.4)](#1.4)

an enumerated type, seekdir[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L868)

It maintains several kinds of data:

- [(2.1)](#2.1)

state information that reflects the integrity of the stream buffer;

- [(2.2)](#2.2)

control information that influences how to interpret (format) input
sequences and how to generate (format) output sequences;

- [(2.3)](#2.3)

additional information that is stored by the program for its private use[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L880)

[*Note [1](#note-1)*:

For the sake of exposition, the maintained data is presented here as:

- [(3.1)](#3.1)

static int *index*,
specifies the next available
unique index for the integer or pointer arrays maintained for the private use
of the program, initialized to an unspecified value;

- [(3.2)](#3.2)

long* *iarray*,
points to the first element of an
arbitrary-lengthlong array maintained for the private use of the
program;

- [(3.3)](#3.3)

void** *parray*,
points to the first element of an
arbitrary-length pointer array maintained for the private use of the program[.](#3.sentence-1)

â *end note*]
