From cppreference.com
This header is part of the
library.
Includes
Forward declarations of all classes in the input/output library
Classes
manages formatting flags and input/output exceptions
(class)
manages an arbitrary stream buffer
(class template)
std::basic_ios<char>(typedef)
std::basic_ios<wchar_t>(typedef)
represents absolute position in a stream or a file
(class template)
(C++11)
the IO stream error codes
(enum)
is_error_code_enum<std::io_errc>
(C++11)
extends the type trait
to identify iostream error codes
(class template specialization)
represents relative file/stream position (offset from fpos), sufficient to represent any file size
(typedef)
represents the number of characters transferred in an I/O operation or the size of an I/O buffer
(typedef)
Functions
(C++11)
identifies the iostream error category
(function)
(C++11)
constructs an iostream error code
(function)
make_error_condition(std::io_errc)
(C++11)
constructs an iostream error condition
(function)
switches between textual and numeric representation of booleans
(function)
controls whether prefix is used to indicate numeric base
(function)
controls whether decimal point is always included in floating-point representation
(function)
controls whether the + sign used with non-negative numbers
(function)
controls whether leading whitespace is skipped on input
(function)
controls whether uppercase characters are used with some output formats
(function)
controls whether output is flushed after each operation
(function)
sets the placement of fill characters
(function)
changes the base used for integer I/O
(function)
fixedscientifichexfloatdefaultfloat
(C++11)(C++11)
changes formatting used for floating-point I/O
(function)
Synopsis
#include<iosfwd>namespacestd{usingstreamoff=/* implementation-defined */;usingstreamsize=/* implementation-defined */;template<classStateT>classfpos;classios_base;template<classCharT,classTraits=char_traits<CharT>>classbasic_ios;// manipulatorsios_base&boolalpha(ios_base&str);ios_base&noboolalpha(ios_base&str);ios_base&showbase(ios_base&str);ios_base&noshowbase(ios_base&str);ios_base&showpoint(ios_base&str);ios_base&noshowpoint(ios_base&str);ios_base&showpos(ios_base&str);ios_base&noshowpos(ios_base&str);ios_base&skipws(ios_base&str);ios_base&noskipws(ios_base&str);ios_base&uppercase(ios_base&str);ios_base&nouppercase(ios_base&str);ios_base&unitbuf(ios_base&str);ios_base&nounitbuf(ios_base&str);// adjustfieldios_base&internal(ios_base&str);ios_base&left(ios_base&str);ios_base&right(ios_base&str);// basefieldios_base&dec(ios_base&str);ios_base&hex(ios_base&str);ios_base&oct(ios_base&str);// floatfieldios_base&fixed(ios_base&str);ios_base&scientific(ios_base&str);ios_base&hexfloat(ios_base&str);ios_base&defaultfloat(ios_base&str);// error reportingenumclassio_errc{stream=1};template<>structis_error_code_enum<io_errc>:publictrue_type{};error_codemake_error_code(io_errce)noexcept;error_conditionmake_error_condition(io_errce)noexcept;consterror_category&iostream_category()noexcept;}Class
namespacestd{classios_base{public:classfailure;// see description// fmtflagsusingfmtflags=/*bitmask-type-1*/;staticconstexprfmtflagsboolalpha=/* unspecified */;staticconstexprfmtflagsdec=/* unspecified */;staticconstexprfmtflagsfixed=/* unspecified */;staticconstexprfmtflagshex=/* unspecified */;staticconstexprfmtflagsinternal=/* unspecified */;staticconstexprfmtflagsleft=/* unspecified */;staticconstexprfmtflagsoct=/* unspecified */;staticconstexprfmtflagsright=/* unspecified */;staticconstexprfmtflagsscientific=/* unspecified */;staticconstexprfmtflagsshowbase=/* unspecified */;staticconstexprfmtflagsshowpoint=/* unspecified */;staticconstexprfmtflagsshowpos=/* unspecified */;staticconstexprfmtflagsskipws=/* unspecified */;staticconstexprfmtflagsunitbuf=/* unspecified */;staticconstexprfmtflagsuppercase=/* unspecified */;staticconstexprfmtflagsadjustfield=/* see description */;staticconstexprfmtflagsbasefield=/* see description */;staticconstexprfmtflagsfloatfield=/* see description */;// iostateusingiostate=/*bitmask-type-2*/;staticconstexpriostatebadbit=/* unspecified */;staticconstexpriostateeofbit=/* unspecified */;staticconstexpriostatefailbit=/* unspecified */;staticconstexpriostategoodbit=/* see description */;// openmodeusingopenmode=/*bitmask-type-3*/;staticconstexpropenmodeapp=/* unspecified */;staticconstexpropenmodeate=/* unspecified */;staticconstexpropenmodebinary=/* unspecified */;staticconstexpropenmodein=/* unspecified */;staticconstexpropenmodeout=/* unspecified */;staticconstexpropenmodetrunc=/* unspecified */;staticconstexpropenmodenoreplace=/* unspecified */// seekdirusingseekdir=/*bitmask-type-4*/;staticconstexprseekdirbeg=/* unspecified */;staticconstexprseekdircur=/* unspecified */;staticconstexprseekdirend=/* unspecified */;classInit;// fmtflags statefmtflagsflags()const;fmtflagsflags(fmtflagsfmtfl);fmtflagssetf(fmtflagsfmtfl);fmtflagssetf(fmtflagsfmtfl,fmtflagsmask);voidunsetf(fmtflagsmask);streamsizeprecision()const;streamsizeprecision(streamsizeprec);streamsizewidth()const;streamsizewidth(streamsizewide);// localeslocaleimbue(constlocale&loc);localegetloc()const;// storagestaticintxalloc();long&iword(intidx);void*&pword(intidx);// destructorvirtual~ios_base();// callbacksenumevent{erase_event,imbue_event,copyfmt_event};usingevent_callback=void(*)(event,ios_base&,intidx);voidregister_callback(event_callbackfn,intidx);ios_base(constios_base&)=delete;ios_base&operator=(constios_base&)=delete;staticboolsync_with_stdio(boolsync=true);protected:ios_base();private:staticintindex;// exposition onlylong*iarray;// exposition onlyvoid**parray;// exposition only};}Class
namespacestd{classios_base::failure:publicsystem_error{public:explicitfailure(conststring&msg,consterror_code&ec=io_errc::stream);explicitfailure(constchar*msg,consterror_code&ec=io_errc::stream);};}Class
namespacestd{classios_base::Init{public:Init();Init(constInit&)=default;~Init();Init&operator=(constInit&)=default;private:staticintinit_cnt;// exposition only};}Class template
namespacestd{template<classStateT>classfpos{public:// membersStateTstate()const;voidstate(stateT);private;StateTst;// exposition only};}Class template
namespacestd{template<classCharT,classTraits=char_traits<CharT>>classbasic_ios:publicios_base{public:usingchar_type=CharT;usingint_type=typenameTraits::int_type;usingpos_type=typenameTraits::pos_type;usingoff_type=typenameTraits::off_type;usingtraits_type=Traits;// flags functionsexplicitoperatorbool()const;booloperator!()const;iostaterdstate()const;voidclear(iostatestate=goodbit);voidsetstate(iostatestate);boolgood()const;booleof()const;boolfail()const;boolbad()const;iostateexceptions()const;voidexceptions(iostateexcept);// constructor/destructorexplicitbasic_ios(basic_streambuf<CharT,Traits>*sb);virtual~basic_ios();// membersbasic_ostream<CharT,Traits>*tie()const;basic_ostream<CharT,Traits>*tie(basic_ostream<CharT,Traits>*tiestr);basic_streambuf<CharT,Traits>*rdbuf()const;basic_streambuf<CharT,Traits>*rdbuf(basic_streambuf<CharT,Traits>*sb);basic_ios©fmt(constbasic_ios&rhs);char_typefill()const;char_typefill(char_typech);localeimbue(constlocale&loc);charnarrow(char_typec,chardfault)const;char_typewiden(charc)const;basic_ios(constbasic_ios&)=delete;basic_ios&operator=(constbasic_ios&)=delete;protected:basic_ios();voidinit(basic_streambuf<CharT,Traits>*sb);voidmove(basic_ios&rhs);voidmove(basic_ios&&rhs);voidswap(basic_ios&rhs)noexcept;voidset_rdbuf(basic_streambuf<CharT,Traits>*sb);};}Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior
C++98 the prototypes of unitbuf and nounitbuf were missing in the synopsis added
C++98 the type of parameter fn of
in the synopsis was misspecified as event_call_backcorrected to
event_callback