Professional Documents
Culture Documents
STD Ios Base - Cppreference
STD Ios Base - Cppreference
class ios_base;
The clas s ios_baseis a multipurpos e clas s that s erves as the bas e clas s for all I/O s tream clas s es . It
maintains s everal kinds of data:
1) s tate information: s tream s tatus ags
2) control information: ags that control formatting of both input and output s equences and the
imbued locale
3) private s torage: indexed extens ible data s tructure that allows both long and void* members ,
which may be implemented as two arbitrary-length arrays or a s ingle array of two-element s tructs
or another container.
4) callbacks : arbitrary number of us er-dened functions to be called from imbue(), copyfmt(), and
~ios _bas e()
Typical implementation holds member cons tants corres ponding to all values of fmtags , ios tate,
openmode, and s eekdir s hown below, member variables to maintain current precis ion, width, and
formatting ags , the exception mas k, the buer error s tate, a res izeable container holding the callbacks ,
the currently imbued locale, the private s torage, and a s tatic integer variable for xalloc().
Member functions
(cons tructor)
(des tructor) [virtual]
Formatting
flags
setf
unsetf
precision
width
Locales
imbue
getloc
s ets locale
(public member func tion)
xalloc[static ]
iword
res izes the private s torage if neces s ary and acces s to the long element at
the given index
(public member func tion)
pword
res izes the private s torage if neces s ary and acces s to the void* element
at the given index
(public member func tion)
Miscellaneous
register_callback
Member classes
s tream exception
failure
Init
Explanation
s tream open mode type
The following cons tants are als o dened:
Constant Explanation
openmode
app
binary
in
out
trunc
ate
(typedef)
Explanation
dec
oct
hex
basefield
fmtflags
left
right
internal
(typedef)
Constant Explanation
iostate
goodbit
no error
badbit
failbit
eofbit
(typedef)
beg
end
cur
(typedef)
event
Type
Explanation
io_state(deprec ated)
uns pecied type that may be us ed like off_type, not neces s arily
std::streamoff
uns pecied type that may be us ed like pos_type, not neces s arily
streampos(deprec ated)
std::streampos
streamoff(deprec ated)
(until C++17)