# <ios> <ios> # `` * * * **`basic_ios· fpos· ios· ios_base· streamoff· streampos· streamsize· wios· wstreampos`** **`boolalpha· dec· fixed· hex· internal· left· noboolalpha· noshowbase· noshowpoint· noshowpos· noskipws· nounitbuf· nouppercase· oct· right· scientific· showbase· showpoint· showpos· skipws· unitbuf· uppercase`** * * * Include the [iostreams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_cpp.html#iostreams) standard header **``** to define several types and functions basic to the operation of iostreams. (This header is typically included for you by another of the iostreams headers. You seldom have occasion to include it directly.) A large group of functions are **manipulators**. A manipulator declared in `` alters the values stored in its argument object of class `ios_base`. Other manipulators perform actions on streams controlled by objects of a type derived from this class, such as a specialization of one of the template classes `basic_istream` or `basic_ostream`. For example, `noskipws(str)` clears the format flag `ios_base::skipws` in the object `str`, which might be of one of these types. You can also call a manipulator by inserting it into an output stream or extracting it from an input stream, thanks to some special machinery supplied in the classes derived from `ios_base`. For example: istr >> noskipws;Copy to clipboard calls `noskipws(istr)`. namespace std { typedef T1 streamoff; typedef T2 streamsize; class ios_base; // TEMPLATE CLASSES template > class basic_ios; typedef basic_ios > ios; typedef basic_ios > wios; template class fpos; typedef fpos streampos; typedef fpos wstreampos; // MANIPULATORS ios_base& boolalpha(ios_base& iosbase); ios_base& noboolalpha(ios_base& iosbase); ios_base& showbase(ios_base& iosbase); ios_base& noshowbase(ios_base& iosbase); ios_base& showpoint(ios_base& iosbase); ios_base& noshowpoint(ios_base& iosbase); ios_base& showpos(ios_base& iosbase); ios_base& noshowpos(ios_base& iosbase); ios_base& skipws(ios_base& iosbase); ios_base& noskipws(ios_base& iosbase); ios_base& unitbuf(ios_base& iosbase); ios_base& nounitbuf(ios_base& iosbase); ios_base& uppercase(ios_base& iosbase); ios_base& nouppercase(ios_base& iosbase); ios_base& internal(ios_base& iosbase); ios_base& left(ios_base& iosbase); ios_base& right(ios_base& iosbase); ios_base& dec(ios_base& iosbase); ios_base& hex(ios_base& iosbase); ios_base& oct(ios_base& iosbase); ios_base& fixed(ios_base& iosbase); ios_base& scientific(ios_base& } // namespace stdCopy to clipboard ## `basic_ios` * * * **`bad· basic_ios· char_type· clear· copyfmt· eof· exceptions· init· fail· good· imbue· init· int_type· narrow· off_type· operator!· operator void *· pos_type· rdbuf· rdstate· setstate· tie· traits_type· widen`** * * * template > class basic_ios : public ios_base { public: typedef Elem char_type; typedef Tr traits_type; typedef typename Tr::int_type int_type; typedef typename Tr::pos_type pos_type; typedef typename Tr::off_type off_type; explicit basic_ios(basic_streambuf *strbuf); virtual ~basic_ios(); operator void *() const; bool operator!() const; iostate rdstate() const; void clear(iostate state = goodbit); void setstate(iostate state); bool good() const; bool eof() const; bool fail() const; bool bad() const; iostate exceptions() const; void exceptions(iostate newexcept); basic_ios& copyfmt(const basic_ios& right); locale imbue(const locale& loc); char_type widen(char ch); char narrow(char_type ch, char dflt); char_type fill() const; char_type fill(char_type ch); basic_ostream *tie() const; basic_ostream *tie(basic_ostream *newtie); basic_streambuf *rdbuf() const; basic_streambuf *rdbuf(basic_streambuf *strbuf); Elem widen(char ch); char narrow(Elem ch, char dflt); protected: void init(basic_streambuf *strbuf); basic_ios(); basic_ios(const facet&); // not defined void operator=(const facet&) // not defined };Copy to clipboard The template class describes the storage and member functions common to both input streams (of template class [`basic_istream`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_istream.html#basic_istream)) and output streams (of template class [`basic_ostream`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ostream.html#basic_ostream)) that depend on the template parameters. (The class [`ios_base`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#ios_base) describes what is common and *not* dependent on template parameters. An object of class `basic_ios` helps control a stream with elements of type `Elem`, whose [character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits) are determined by the class `Tr`. An object of class `basic_ios` stores: - a **tie pointer** to an object of type `basic_ostream` - a **stream buffer pointer** to an object of type `basic_streambuf` - [formatting information](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#formatting%20information) - [stream state information](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#stream%20state%20information) in a base object of type [`ios_base`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#ios_base) - a **fill character** in an object of type *char\_type* ### `basic_ios::bad` bool bad() const;Copy to clipboard The member function returns true if `rdstate() & badbit` is nonzero. ### `basic_ios::basic_ios` explicit basic_ios(basic_streambuf *strbuf); basic_ios();Copy to clipboard The first constructor initializes its member objects by calling `init(strbuf)`. The second (protected) constructor leaves its member objects uninitialized. A later call to `init` *must* initialize the object before it can be safely destroyed. ### `basic_ios::char_type` typedef Elem char_type;Copy to clipboard The type is a synonym for the template parameter `Elem`. ### `basic_ios::clear` void clear(iostate state = goodbit);Copy to clipboard The member function replaces the stored [stream state information](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#stream%20state%20information) with `state | (rdbuf() != 0 ? goodbit : badbit)`. If `state & exceptions()` is nonzero, it then throws an object of class `failure`. ### `basic_ios::copyfmt` basic_ios& copyfmt(const basic_ios& right);Copy to clipboard The member function reports the [callback event](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#callback%20event) `erase_event`. It then copies from `right` into `*this` the [fill character](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#fill%20character), the [tie pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#tie%20pointer), and the [formatting information](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#formatting%20information). Before altering the [exception mask](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#exception%20mask), it reports the callback event `copyfmt_event`. If, after the copy is complete, `state & exceptions()` is nonzero, the function effectively calls `clear` with the argument `rdstate()`. It returns `*this`. ### `basic_ios::eof` bool eof() const;Copy to clipboard The member function returns true if `rdstate() & eofbit` is nonzero. ### `basic_ios::exceptions` iostate exceptions() const; void exceptions(iostate newexcept);Copy to clipboard The first member function returns the stored [exception mask](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#exception%20mask). The second member function stores `except` in the exception mask. Note that storing a new exception mask can throw an exception just like the call `clear( rdstate())`. ### `basic_ios::fail` bool fail() const;Copy to clipboard The member function returns true if `rdstate() & (badbit | failbit)` is nonzero. ### `basic_ios::fill` char_type fill() const; char_type fill(char_type ch);Copy to clipboard The first member function returns the stored [fill character](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#fill%20character). The second member function stores `ch` in the fill character and returns its previous stored value. ### `basic_ios::good` bool good() const;Copy to clipboard The member function returns true if `rdstate() == goodbit` (no state flags are set). ### `basic_ios::imbue` locale imbue(const locale& loc);Copy to clipboard The member function calls `ios_base::imbue(loc)`. If `rdbuf` is not a null pointer, it also calls `rdbuf()->pubimbue(loc)`. In any case, it returns the value returned by the call to `ios_base::imbue`. ### `basic_ios::init` void init(basic_streambuf *strbuf);Copy to clipboard The member function stores values in all member objects, so that: - `rdbuf()` returns `strbuf` - `tie()` returns a null pointer - `rdstate()` returns `goodbit` if `strbuf` is nonzero; otherwise, it returns `badbit` - `exceptions()` returns `goodbit` - `flags()` returns `skipws | dec` - `width()` returns zero - `precision()` returns 6 - `fill()` returns the space character - `getloc()` returns `locale::classic()` - `iword` returns zero and `pword` returns a null pointer for all argument value ### `basic_ios::int_type` typedef typename Ty::int_type int_type;Copy to clipboard The type is a synonym for `Ty::int_type`. ### `basic_ios::narrow` char narrow(char_type ch, char dflt);Copy to clipboard The member function returns `use_facet< ctype >( getloc()). narrow(ch, dflt)`. ### `basic_ios::off_type` typedef typename Ty::off_type off_type;Copy to clipboard The type is a synonym for `Ty::off_type`. ### `basic_ios::operator void *` operator void *() const;Copy to clipboard The operator returns a null pointer only if `fail()`. ### `basic_ios::operator!` bool operator!() const;Copy to clipboard The operator returns `fail()`. ### `basic_ios::pos_type` typedef typename Ty::pos_type pos_type;Copy to clipboard The type is a synonym for `Ty::pos_type`. ### `basic_ios::rdbuf` basic_streambuf *rdbuf() const; basic_streambuf *rdbuf(basic_streambuf *strbuf);Copy to clipboard The first member function returns the stored [stream buffer pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#stream%20buffer%20pointer). The second member function stores `strbuf` in the stored [stream buffer pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#stream%20buffer%20pointer) and returns the previously stored value. ### `basic_ios::rdstate` iostate rdstate() const;Copy to clipboard The member function returns the stored [stream state information](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#stream%20state%20information). ### `basic_ios::setstate` void setstate(iostate state);Copy to clipboard The member function effectively calls `clear(state | rdstate())`. ### `basic_ios::tie` basic_ostream *tie() const; basic_ostream *tie(basic_ostream *newtie);Copy to clipboard The first member function returns the stored [tie pointer](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#tie%20pointer). The second member function stores `newtie` in the tie pointer and returns its previous stored value. ### `basic_ios::traits_type` typedef Tr traits_type;Copy to clipboard The type is a synonym for the template parameter `Tr`. ### `basic_ios::widen` char_type widen(char ch);Copy to clipboard The member function returns `use_facet< ctype >( getloc()). widen(ch)`. ## `boolalpha` ios_base& boolalpha(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: boolalpha)`, then returns `iosbase`. ## `dec` ios_base& dec(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: dec, ios_base:: basefield)`, then returns `iosbase`. ## `fixed` ios_base& fixed(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: fixed, ios_base:: floatfield)`, then returns `iosbase`. ## `fpos` template class fpos { public: fpos(streamoff off); fpos(St state, fpos_t filepos); St state() const; void state(St state); operator streamoff() const; streamoff operator-(const fpos& right) const; fpos& operator+=(streamoff off); fpos& operator-=(streamoff off); fpos operator+(streamoff off) const; fpos operator-(streamoff off) const; bool operator==(const fpos& right) const; bool operator!=(const fpos& right) const; };Copy to clipboard The template class describes an object that can store all the information needed to restore an arbitrary [file-position indicator](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#file-position%20indicator) within any stream. An object of class `fpos` effectively stores at least two member objects: - a byte offset, of type `streamoff` - a conversion state, for use by an object of class `basic_filebuf`, of type **`St`**, typically `mbstate_t` It can also store an arbitrary file position, for use by an object of class `basic_filebuf`, of type `fpos_t`. For an environment with limited file size, however, `streamoff` and `fpos_t` may sometimes be used interchangeably. And for an environment with no streams that have a [state-dependent encoding](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_charset.html#state-dependent%20encoding), `mbstate_t` may actually be unused. So the number of member objects stored may vary. ### `fpos::fpos` fpos(streamoff off); fpos(St state, fpos_t filepos);Copy to clipboard The first constructor stores the offset `off`, relative to the beginning of file and in the [initial conversion state](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_charset.html#initial%20conversion%20state) (if that matters). If `off` is -1, the resulting object represents an invalid stream position. The second constructor stores the object `state` and a file position determined by `filepos`. ### `fpos::operator!=` bool operator!=(const fpos& right) const;Copy to clipboard The member function returns `!(*this == right)`. ### `fpos::operator+` fpos operator+(streamoff off) const;Copy to clipboard The member function returns `fpos(*this) += off`. ### `fpos::operator+=` fpos& operator+=(streamoff off);Copy to clipboard The member function adds `off` to the stored offset member object, then returns `*this`. For positioning within a file, the result is generally valid only for [binary streams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#binary%20stream) that do not have a [state-dependent encoding](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_charset.html#state-dependent%20encoding). ### `fpos::operator-` streamoff operator-(const fpos& right) const; fpos operator-(streamoff off) const;Copy to clipboard The first member function returns `(streamoff)*this - (streamoff)right`. The second member function returns `fpos(*this) -= off`. ### `fpos::operator-=` fpos& operator-=(streamoff off);Copy to clipboard The member function returns `fpos(*this) -= off`. For positioning within a file, the result is generally valid only for [binary streams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#binary%20stream) that do not have a [state-dependent encoding](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_charset.html#state-dependent%20encoding). ### `fpos::operator==` bool operator==(const fpos& right) const;Copy to clipboard The member function returns `(streamoff)*this == (streamoff)right`. ### `fpos::operator streamoff` operator streamoff() const;Copy to clipboard The member function returns the stored offset member object, plus any additional offset stored as part of the `fpos_t` member object. ### `fpos::state` St state() const; void state(St state);Copy to clipboard The first member function returns the value stored in the `St` member object. The second member function stores `state` in the `St` member object. ## `hex` ios_base& hex(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: hex, ios_base:: basefield)`, then returns `iosbase`. ## `internal` ios_base& internal(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: internal, ios_base:: adjustfield)`, then returns `iosbase`. ## `ios` typedef basic_ios > ios;Copy to clipboard The type is a synonym for template class [`basic_ios`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#basic_ios), specialized for elements of type *char* with default [character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits). ## `ios_base` * * * **`event· event_callback· failure· flags· fmtflags· getloc· imbue· Init· ios_base· iostate· iword· openmode· operator=· precision· pword· register_callback· seekdir· setf· streamoff· streampos· sync_with_stdio· unsetf· width· xalloc`** * * * class ios_base { public: class failure; typedef T1 fmtflags; static const fmtflags boolalpha, dec, fixed, hex, internal, left, oct, right, scientific, showbase, showpoint, showpos, skipws, unitbuf, uppercase, adjustfield, basefield, floatfield; typedef T2 iostate; static const iostate badbit, eofbit, failbit, goodbit; typedef T3 openmode; static const openmode app, ate, binary, in, out, trunc; typedef T4 seekdir; typedef std::streamoff streamoff; typedef std::streampos streampos; static const seekdir beg, cur, end; enum event { copyfmt_event, erase_event, imbue_event}; static const event copyfmt_event, erase_event, copyfmt_event; class Init; ios_base& operator=(const ios_base& right); fmtflags flags() const; fmtflags flags(fmtflags newfmtflags); fmtflags setf(fmtflags newfmtflags); fmtflags setf(fmtflags newfmtflags, fmtflags mask); void unsetf(fmtflags mask); streamsize precision() const; streamsize precision(streamsize newprecision); streamsize width() const; stramsize width(streamsize newwidth); locale imbue(const locale& loc); locale getloc() const; static int xalloc(); long& iword(int idx); void *& pword(int idx); typedef void *(event_callback(event ev, ios_base& iosbase, int idx); void register_callback(event_callback pfn, int idx); static bool sync_with_stdio(bool newsync = true); protected: ios_base(); };Copy to clipboard The class describes the storage and member functions common to both input and output streams that does not depend on the template parameters. (The template class [`basic_ios`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#basic_ios) describes what is common and *is* dependent on template parameters. An object of class `ios_base` stores **formatting information**, which consists of: - **format flags** in an object of type [`fmtflags`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#ios_base::fmtflags) - an **exception mask** in an object of type [`iostate`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#ios_base::iostate) - a **field width** in an object of type *int* - a **display precison** in an object of type *int* - a **[locale object](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_locale2.html#locale%20object)** in an object of type `locale` - two **extensible arrays**, with elements of type *long* and *void* pointer An object of class `ios_base` also stores **stream state information**, in an object of type [`iostate`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#ios_base::iostate), and a **callback stack**. ### `ios_base::event` enum event { copyfmt_event, erase_event, imbue_event};Copy to clipboard The type is an enumeration that describes an object that can store the **callback event** used as an argument to a function registered with `register_callback`. The distinct event values are: - `copyfmt_event`, to identify a callback that occurs near the end of a call to `copyfmt`, just before the [exception mask](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#exception%20mask) is copied. - `erase_event`, to identify a callback that occurs at the beginning of a call to `copyfmt`, or at the beginning of a call to the destructor for `*this`. - `imbue_event`, to identify a callback that occurs at the end of a call to `imbue`, just before the function returns. ### `ios_base::event_callback` typedef void *(event_callback(event ev, ios_base& iosbase, int idx);Copy to clipboard The type describes a pointer to a function that can be registered with `register_callback`. Such a function must not throw an exception. ### `ios_base::failure` class failure : public exception { public: explicit failure(const string& what_arg) { };Copy to clipboard The member class serves as the base class for all exceptions thrown by the member function `clear` in template class [`basic_ios`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#basic_ios). The value returned by `what()` is `what_arg.data()`. ### `ios_base::flags` fmtflags flags() const; fmtflags flags(fmtflags newfmtflags);Copy to clipboard The first member function returns the stored [format flags](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#format%20flags). The second member function stores `newfmtflags` in the format flags and returns its previous stored value. ### `ios_base::fmtflags` typedef T1 fmtflags; static const fmtflags boolalpha, dec, fixed, hex, internal, left, oct, right, scientific, showbase, showpoint, showpos, skipws, unitbuf, uppercase, adjustfield, basefield, floatfield;Copy to clipboard The type is a [bitmask type](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_cpp.html#bitmask%20type) `T1` that describes an object that can store [format flags](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#format%20flags). The distinct flag values (elements) are: - `boolalpha`, to insert or extract objects of type *bool* as names (such as `true` and `false`) rather than as numeric values - `dec`, to insert or extract integer values in decimal format - `fixed`, to insert floating-point values in fixed-point format (with no exponent field) - `hex`, to insert or extract integer values in hexadecimal format - `internal`, to pad to a [field width](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#field%20width) as needed by inserting [fill characters](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#fill%20character) at a point internal to a generated numeric field - `left`, to pad to a [field width](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#field%20width) as needed by inserting [fill characters](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#fill%20character) at the end of a generated field (left justification) - `oct`, to insert or extract integer values in octal format - `right`, to pad to a [field width](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#field%20width) as needed by inserting [fill characters](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#fill%20character) at the beginning of a generated field (right justification) - `scientific`, to insert floating-point values in scientific format (with an exponent field) - `showbase`, to insert a prefix that reveals the base of a generated integer field - `showpoint`, to insert a decimal point unconditionally in a generated floating-point field - `showpos`, to insert a plus sign in a non-negative generated numeric field - `skipws`, to skip leading [white space](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_prin.html#white%20space) before certain extractions - `unitbuf`, to flush output after each insertion - `uppercase`, to insert uppercase equivalents of lowercase letters in certain insertions In addition, several useful values are: - `adjustfield`, `internal | left | right` - `basefield`, `dec | hex | oct` - `floatfield`, `fixed | scientific` ### `ios_base::getloc` locale getloc() const;Copy to clipboard The member function returns the stored locale object. ### `ios_base::imbue` locale imbue(const locale& loc);Copy to clipboard The member function stores `loc` in the locale object, then reports the [callback event](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#callback%20event) `imbue_event`. It returns the previous stored value. ### `ios_base::Init` class Init { };Copy to clipboard The nested class describes an object whose construction ensures that the standard iostreams objects are properly [constructed](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_iostream.html#constructing%20iostreams), even before the execution of a constructor for an arbitrary static object. ### `ios_base::ios_base` ios_base();Copy to clipboard The (protected) constructor does nothing. A later call to `basic_ios::init` *must* initialize the object before it can be safely destroyed. Thus, the only safe use for class `ios_base` is as a base class for template class `basic_ios`. ### `ios_base::iostate` typedef T2 iostate; static const iostate badbit, eofbit, failbit, goodbit;Copy to clipboard The type is a [bitmask type](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_cpp.html#bitmask%20type) `T2` that describes an object that can store [stream state information](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#stream%20state%20information). The distinct flag values (elements) are: - `badbit`, to record a loss of integrity of the stream buffer - `eofbit`, to record end-of-file while extracting from a stream - `failbit`, to record a failure to extract a valid field from a stream In addition, a useful value is: - `goodbit`, no bits set ### `ios_base::iword` long& iword(int idx);Copy to clipboard The member function returns a reference to element `idx` of the [extensible array](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#extensible%20arrays) with elements of type *long.* All elements are effectively present and initially store the value zero. The returned reference is invalid after the next call to `iword` for the object, after the object is altered by a call to `basic_ios::copyfmt`, or after the object is destroyed. If `idx` is negative, or if unique storage is unavailable for the element, the function calls `setstate(badbit)` and returns a reference that might not be unique. To obtain a unique index, for use across all objects of type `ios_base`, call `xalloc`. ### `ios_base::openmode` typedef T3 openmode; static const openmode app, ate, binary, in, out, trunc;Copy to clipboard The type is a [bitmask type](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_cpp.html#bitmask%20type) `T3` that describes an object that can store the **opening mode** for several iostreams objects. The distinct flag values (elements) are: - `app`, to seek to the end of a stream before each insertion - `ate`, to seek to the end of a stream when its controlling object is first created - `binary`, to read a file as a [binary stream](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#binary%20stream), rather than as a [text stream](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_file.html#text%20stream) - `in`, to permit extraction from a stream - `out`, to permit insertion to a stream - `trunc`, to truncate an existing file when its controlling object is first created ### `ios_base::operator=` ios_base& operator=(const ios_base& right);Copy to clipboard The operator copies the stored [formatting information](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#formatting%20information), making a new copy of any [extensible arrays](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#extensible%20arrays). It then returns `*this`. Note that the [callback stack](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#callback%20stack) is *not* copied. ### `ios_base::precision` streamsize precision() const; streamsize precision(streamsize newprecision);Copy to clipboard The first member function returns the stored [display precision](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#display%20precision). The second member function stores `newprecision` in the display precision and returns its previous stored value. ### `ios_base::pword` void *& pword(int idx);Copy to clipboard The member function returns a reference to element `idx` of the [extensible array](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#extensible%20arrays) with elements of type *void* pointer. All elements are effectively present and initially store the null pointer. The returned reference is invalid after the next call to `pword` for the object, after the object is altered by a call to `basic_ios::copyfmt`, or after the object is destroyed. If `idx` is negative, or if unique storage is unavailable for the element, the function calls `setstate(badbit)` and returns a reference that might not be unique. To obtain a unique index, for use across all objects of type `ios_base`, call `xalloc`. ### `ios_base::register_callback` void register_callback(event_callback pfn, int idx);Copy to clipboard The member function pushes the pair `{pfn, idx}` onto the stored [callback stack](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#callback%20stack). When a [callback event](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#callback%20event) `ev` is reported, the functions are called, in reverse order of registry, by the expression `(*pfn)(ev, *this, idx)`. ### `ios_base::seekdir` typedef T4 seekdir; static const seekdir beg, cur, end;Copy to clipboard The type is an enumerated type `T4` that describes an object that can store the **seek mode** used as an argument to the member functions of several iostreams classes. The distinct flag values are: - `beg`, to seek (alter the current read or write position) relative to the beginning oc a sequence (array, stream, or file) - `cur`, to seek relative to the current position within a sequence - `end`, to seek relative to the end of a sequence ### `ios_base::setf` void setf(fmtflags newfmtflags); fmtflags setf(fmtflags newfmtflags, fmtflags mask);Copy to clipboard The first member function effectively calls `flags(newfmtflags | flags())` (set selected bits), then returns the previous [format flags](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#format%20flags). The second member function effectively calls `flags(mask & newfmtflags, flags() & ~mask)` (replace selected bits under a mask), then returns the previous format flags. ### `ios_base::streamoff` typedef std::streamoff streamoff;Copy to clipboard The type is a synonym for `std::streamoff`. ### `ios_base::streampos` typedef std::streampos streampos;Copy to clipboard The type is a synonym for `std::streampos`. ### `ios_base::sync_with_stdio` static bool sync_with_stdio(bool newsync = true);Copy to clipboard The static member function stores a **stdio sync flag**, which is initially true. When true, this flag ensures that operations on the same file are properly synchronized between the [iostreams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_cpp.html#iostreams) functions and those defined in the [Standard C library](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_index.html#Standard%20C%20Library). Otherwise, synchronization may or may not be guaranteed, but performance may be improved. The function stores `newsync` in the stdio sync flag and returns its previous stored value. You can call it reliably only before performing any operations on the [standard streams](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_lib_over.html#standard%20streams). ### `ios_base::unsetf` void unsetf(fmtflags mask);Copy to clipboard The member function effectively calls `flags(~mask & flags())` (clear selected bits). ### `ios_base::width` streamsize width() const; streamsize width(streamsize newwidth);Copy to clipboard The first member function returns the stored [field width](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#field%20width). The second member function stores `newwidth` in the field width and returns its previous stored value. ### `ios_base::xalloc` static int xalloc();Copy to clipboard The static member function returns a stored static value, which it increments on each call. You can use the return value as a unique index argument when calling the member functions `iword` or `pword`. ## `left` ios_base& left(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: left, ios_base:: adjustfield)`, then returns `iosbase`. ## `noboolalpha` ios_base& noboolalpha(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.unsetf(ios_base:: boolalpha)`, then returns `iosbase`. ## `noshowbase` ios_base& noshowbase(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.unsetf(ios_base:: showbase)`, then returns `iosbase`. ## `noshowpoint` ios_base& noshowpoint(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.unsetf(ios_base:: showpoint)`, then returns `iosbase`. ## `noshowpos` ios_base& noshowpos(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.unsetf(ios_base:: showpos")`, then returns `iosbase`. ## `noskipws` ios_base& noskipws(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.unsetf(ios_base:: skipws)`, then returns `iosbase`. ## `nounitbuf` ios_base& nounitbuf(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.unsetf(ios_base:: unitbuf)`, then returns `iosbase`. ## `nouppercase` ios_base& nouppercase(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.unsetf(ios_base:: uppercase)`, then returns `iosbase`. ## `oct` ios_base& oct(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: oct, ios_base:: basefield)`, then returns `iosbase`. ## `right` ios_base& right(ios_base& iosbase);Copy to clipboard The maiipulator effectively calls `iosbase.setf(ios_base:: right, ios_base:: adjustfield)`, then returns `iosbase`. ## `scientific` ios_base& scientific(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: scientific, ios_base:: floatfield)`, then returns `iosbase`. ## `showbase` ios_base& showbase(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: showbase)`, then returns `iosbase`. ## `showpoint` ios_base& showpoint(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: showpoint)`, then returns `iosbase`. ## `showpos` ios_base& showpos(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: showpos)`, then returns `iosbase`. ## `skipws` ios_base& skipws(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: skipws)`, then returns `iosbase`. ## `streamoff` typedef T1 streamoff;Copy to clipboard The type is a signed integer type `T1` that describes an object that can store a byte offset involved in various stream positioning operations. Its representation has at least 32 value bits. It is *not* necessarily large enough to represent an arbitrary byte position within a stream. The value `streamoff(-1)` generally indicates an erroneous offset. ## `streampos` typedef fpos streampos;Copy to clipboard The type is a synonym for `fpos< mbstate_t>`. ## `streamsize` typedef T2 streamsize;Copy to clipboard The type is a signed integer type `T2` that describes an object that can store a count of the number of elements involved in various stream operations. Its representation has at least 16 bits. It is *not* necessarily large enough to represent an arbitrary byte position within a stream. ## `unitbuf` ios_base& unitbuf(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: unitbuf)`, then returns `iosbase`. ## `uppercase` ios_base& uppercase(ios_base& iosbase);Copy to clipboard The manipulator effectively calls `iosbase.setf(ios_base:: uppercase)`, then returns `iosbase`. ## `wios` typedef basic_ios > wios;Copy to clipboard The type is a synonym for template class [`basic_ios`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_ios.html#basic_ios), specialized for elements of type `wchar_t` with default [character traits](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_string2.html#character%20traits). ## `wstreampos` typedef fpos wstreampos;Copy to clipboard The type is a synonym for `fpos< mbstate_t>`. * * * See also the **[Table of Contents](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_index.html#Table%20of%20Contents)** and the **[Index](https://docs.qualcomm.com/doc/80-N3040-23/topic/_cpp_index.html)**. *[Copyright](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_crit_pjp.html) © 1992-2006by P.J. Plauger. All rights reserved.* Last Published: Oct 06, 2026 Previous Topic Next Topic