STD::WOFSTREAM(3)

Hey bestie! ๐Ÿ’– Welcome to the Library Functions Manual, section 3. We're about to vibe with std::basic_ofstream< _CharT, _Traits >. It's literally the main character for controlling output to files. ๐Ÿ“โœจ No cap.


โœจ NAME โœจ

std::basic_ofstream< _CharT, _Traits > โ€” it's giving "controlling output for files." ๐Ÿ’…๐Ÿ“

๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <fstream>

Inherits std::basic_ostream< _CharT, _Traits >. ๐Ÿ‘‘

๐ŸŽ€ Public Types ๐ŸŽ€

  • typedef ctype< _CharT > __ctype_type
  • typedef basic_filebuf< char_type, traits_type > __filebuf_type
  • typedef basic_ios< _CharT, _Traits > __ios_type
  • typedef num_put< _CharT, ostreambuf_iterator< _CharT, _Traits > > __num_put_type
  • typedef basic_ostream< char_type, traits_type > __ostream_type
  • typedef basic_streambuf< _CharT, _Traits > __streambuf_type
  • typedef _CharT char_type
  • enum event { erase_event, imbue_event, copyfmt_event } โ€” the set of events that may be passed to an event callback. ๐ŸŽ‰
  • typedef void(* event_callback) (event __e, ios_base &__b, int __i) โ€” the type of an event callback function. ๐Ÿ“ž
  • typedef _Ios_Fmtflags fmtflags โ€” this is a bitmask type. ๐Ÿ”ข
  • typedef traits_type::int_type int_type
  • typedef _Ios_Iostate iostate โ€” this is a bitmask type. ๐Ÿ”ข
  • typedef traits_type::off_type off_type
  • typedef _Ios_Openmode openmode โ€” this is a bitmask type. ๐Ÿ”ข
  • typedef traits_type::pos_type pos_type
  • typedef _Ios_Seekdir seekdir โ€” this is an enumerated type. ๐Ÿ“‹
  • typedef _Traits traits_type
  • typedef num_get< _CharT, istreambuf_iterator< _CharT, _Traits > > __num_get_type

๐Ÿซถ Public Member Functions ๐Ÿซถ

  • basic_ofstream () โ€” default constructor. โœจ
  • basic_ofstream (basic_ofstream &&__rhs)
  • template<typename _Path, typename _Require = _If_fs_path<_Path>> basic_ofstream (const _Path &__s, ios_base::openmode __mode=ios_base::out) โ€” create an output file stream. ๐Ÿ“
  • basic_ofstream (const basic_ofstream &)=delete โ€” not today, bestie. ๐Ÿšซ
  • basic_ofstream (const char *__s, ios_base::openmode __mode=ios_base::out) โ€” create an output file stream. ๐Ÿ“
  • basic_ofstream (const std::string &__s, ios_base::openmode __mode=ios_base::out) โ€” create an output file stream. ๐Ÿ“
  • ~basic_ofstream () โ€” the destructor does nothing. ๐Ÿ’ค
  • const locale & _M_getloc () const โ€” locale access. ๐ŸŒ
  • template<typename _ValueT> basic_ostream< _CharT, _Traits > & _M_insert (_ValueT __v)
  • void _M_setstate (iostate __state)
  • bool bad () const โ€” fast error checking. ๐Ÿšจ
  • void clear (iostate __state=goodbit) โ€” [re]sets the error state. ๐Ÿงน
  • void close () โ€” close the file. ๐Ÿ“
  • basic_ios & copyfmt (const basic_ios &__rhs) โ€” copies fields of __rhs into this. ๐Ÿ“‹
  • bool eof () const โ€” fast error checking. ๐Ÿšจ
  • iostate exceptions () const โ€” throwing exceptions on errors. ๐Ÿ’ฅ
  • void exceptions (iostate __except) โ€” throwing exceptions on errors. ๐Ÿ’ฅ
  • bool fail () const โ€” fast error checking. ๐Ÿšจ
  • char_type fill () const โ€” retrieves the empty character. ๐Ÿ•ณ๏ธ
  • char_type fill (char_type __ch) โ€” sets a new empty character. ๐Ÿ•ณ๏ธ
  • fmtflags flags () const โ€” access to format flags. ๐Ÿšฉ
  • fmtflags flags (fmtflags __fmtfl) โ€” setting new format flags all at once. ๐Ÿšฉ
  • __ostream_type & flush () โ€” synchronizing the stream buffer. ๐Ÿšฝ
  • locale getloc () const โ€” locale access. ๐ŸŒ
  • bool good () const โ€” fast error checking. ๐Ÿšจ
  • locale imbue (const locale &__loc) โ€” moves to a new locale. ๐ŸŒ
  • bool is_open () โ€” wrapper to test for an open file. ๐Ÿ“‚
  • bool is_open () const
  • long & iword (int __ix) โ€” access to integer array. ๐Ÿ”ข
  • char narrow (char_type __c, char __dfault) const โ€” squeezes characters. ๐Ÿ—œ๏ธ
  • template<typename _Path> _If_fs_path< _Path, void > open (const _Path &__s, ios_base::openmode __mode=ios_base::out) โ€” opens an external file. ๐Ÿ“‚
  • void open (const char *__s, ios_base::openmode __mode=ios_base::out) โ€” opens an external file. ๐Ÿ“‚
  • void open (const std::string &__s, ios_base::openmode __mode=ios_base::out) โ€” opens an external file. ๐Ÿ“‚
  • __ostream_type & operator<< (__streambuf_type *__sb) โ€” extracting from another streambuf. ๐ŸŽฃ
  • __ostream_type & operator<< (const void *__p) โ€” pointer arithmetic inserters. ๐Ÿ‘‰
  • __ostream_type & operator<< (const volatile void *__p)
  • __ostream_type & operator<< (nullptr_t)
  • basic_ofstream & operator= (basic_ofstream &&__rhs)
  • basic_ofstream & operator= (const basic_ofstream &)=delete
  • streamsize precision () const โ€” flags access. ๐ŸŽฏ
  • streamsize precision (streamsize __prec) โ€” changing flags. ๐ŸŽฏ
  • void *& pword (int __ix) โ€” access to void pointer array. ๐Ÿ‘‰
  • basic_streambuf< _CharT, _Traits > * rdbuf (basic_streambuf< _CharT, _Traits > *__sb) โ€” changing the underlying buffer. ๐Ÿ”„
  • __filebuf_type * rdbuf () const โ€” accessing the underlying buffer. ๐Ÿ”„
  • iostate rdstate () const โ€” returns the error state of the stream buffer. ๐Ÿ“Š
  • void register_callback (event_callback __fn, int __index) โ€” add the callback __fn with parameter __index. ๐Ÿ“ž
  • __ostream_type & seekp (off_type, ios_base::seekdir) โ€” changing the current write position. ๐Ÿ“
  • __ostream_type & seekp (pos_type) โ€” changing the current write position. ๐Ÿ“
  • fmtflags setf (fmtflags __fmtfl) โ€” setting new format flags. ๐Ÿšฉ
  • fmtflags setf (fmtflags __fmtfl, fmtflags __mask) โ€” setting new format flags. ๐Ÿšฉ
  • void setstate (iostate __state) โ€” sets additional flags in the error state. ๐Ÿšฉ
  • void swap (basic_ofstream &__rhs)
  • pos_type tellp () โ€” getting the current write position. ๐Ÿ“
  • basic_ostream< _CharT, _Traits > * tie () const โ€” fetches the current tied stream. ๐Ÿ”—
  • basic_ostream< _CharT, _Traits > * tie (basic_ostream< _CharT, _Traits > *__tiestr) โ€” ties this stream to an output stream. ๐Ÿ”—
  • void unsetf (fmtflags __mask) โ€” clearing format flags. ๐Ÿงน
  • char_type widen (char __c) const โ€” widens characters. โ†”๏ธ
  • streamsize width () const โ€” flags access. ๐Ÿ“
  • streamsize width (streamsize __wide) โ€” changing flags. ๐Ÿ“
  • __ostream_type & operator<< (__ostream_type &(*__pf)(__ostream_type &)) โ€” interface for manipulators. ๐ŸŽ›๏ธ
  • __ostream_type & operator<< (__ios_type &(*__pf)(__ios_type &)) โ€” interface for manipulators. ๐ŸŽ›๏ธ
  • __ostream_type & operator<< (ios_base &(*__pf)(ios_base &)) โ€” interface for manipulators. ๐ŸŽ›๏ธ

๐Ÿ”ฅ Inserters ๐Ÿ”ฅ

Okay so all the operator<< functions (aka formatted output functions) have some common behavior. Each one starts by constructing a temporary object of type std::basic_ostream::sentry. This can have several effects, concluding with the setting of a status flag; see the sentry documentation for more. ๐Ÿ‘€

If the sentry status is good, the function tries to generate whatever data is appropriate for the type of the argument. โœจ

If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state without causing an ios_base::failure to be thrown. The original exception will then be rethrown. ๐Ÿ˜ฑ

  • __ostream_type & operator<< (long __n) โ€” integer arithmetic inserters. ๐Ÿ”ข
  • __ostream_type & operator<< (unsigned long __n) โ€” integer arithmetic inserters. ๐Ÿ”ข
  • __ostream_type & operator<< (bool __n) โ€” integer arithmetic inserters. ๐Ÿ”ข
  • __ostream_type & operator<< (short __n) โ€” integer arithmetic inserters. ๐Ÿ”ข
  • __ostream_type & operator<< (unsigned short __n) โ€” integer arithmetic inserters. ๐Ÿ”ข
  • __ostream_type & operator<< (int __n) โ€” integer arithmetic inserters. ๐Ÿ”ข
  • __ostream_type & operator<< (unsigned int __n) โ€” integer arithmetic inserters. ๐Ÿ”ข
  • __ostream_type & operator<< (long long __n) โ€” integer arithmetic inserters. ๐Ÿ”ข
  • __ostream_type & operator<< (unsigned long long __n) โ€” integer arithmetic inserters. ๐Ÿ”ข
  • __ostream_type & operator<< (double __f) โ€” floating point arithmetic inserters. ๐Ÿงฎ
  • __ostream_type & operator<< (float __f) โ€” floating point arithmetic inserters. ๐Ÿงฎ
  • __ostream_type & operator<< (long double __f) โ€” floating point arithmetic inserters. ๐Ÿงฎ

๐ŸŒธ Unformatted Output Functions ๐ŸŒธ

All the unformatted output functions have some common behavior. Each one starts by constructing a temporary object of type std::basic_ostream::sentry. This has several effects, concluding with the setting of a status flag; see the sentry documentation for more. ๐Ÿ‘€

If the sentry status is good, the function tries to generate whatever data is appropriate for the type of the argument. โœจ

If an exception is thrown during insertion, ios_base::badbit will be turned on in the stream's error state. If badbit is on in the stream's exceptions mask, the exception will be rethrown without completing its actions. ๐Ÿ’ฅ

  • __ostream_type & put (char_type __c) โ€” simple insertion. ๐ŸŽฏ
  • __ostream_type & write (const char_type *__s, streamsize __n) โ€” character string insertion. โœ๏ธ
  • operator bool () const โ€” the quick-and-easy status check. โœ…
  • bool operator! () const โ€” the quick-and-easy status check. โŒ

๐Ÿ‘‘ Static Public Member Functions ๐Ÿ‘‘

  • static bool sync_with_stdio (bool __sync=true) โ€” interaction with the standard C I/O objects. ๐Ÿ”„
  • static int xalloc () throw () โ€” access to unique indices. ๐Ÿ”‘

๐ŸŒธ Static Public Attributes ๐ŸŒธ

okay so these are the static constants the class hands you, and bestie, there's a LOT. they're your little building blocks for flags and modes, no cap ๐Ÿ’…

  • static const openmode __noreplace โ€” (no description given, it's just there, living its truth โœจ)
  • static const fmtflags adjustfield โ€” A mask of left|right|internal. Useful for the 2-arg form of setf.
  • static const openmode app โ€” Seek to end before each write.
  • static const openmode ate โ€” Open and seek to end immediately after opening.
  • static const iostate badbit โ€” Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file).
  • static const fmtflags basefield โ€” A mask of dec|oct|hex. Useful for the 2-arg form of setf.
  • static const seekdir beg โ€” Request a seek relative to the beginning of the stream.
  • static const openmode binary โ€” Perform input and output in binary mode (as opposed to text mode). This is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary.
  • static const fmtflags boolalpha โ€” Insert/extract bool in alphabetic rather than numeric format.
  • static const seekdir cur โ€” Request a seek relative to the current position within the sequence.
  • static const fmtflags dec โ€” Converts integer input or generates integer output in decimal base.
  • static const seekdir end โ€” Request a seek relative to the current end of the sequence.
  • static const iostate eofbit โ€” Indicates that an input operation reached the end of an input sequence.
  • static const iostate failbit โ€” Indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters.
  • static const fmtflags fixed โ€” Generate floating-point output in fixed-point notation.
  • static const fmtflags floatfield โ€” A mask of scientific|fixed. Useful for the 2-arg form of setf.
  • static const iostate goodbit โ€” Indicates all is well. ๐Ÿซถ
  • static const fmtflags hex โ€” Converts integer input or generates integer output in hexadecimal base.
  • static const openmode in โ€” Open for input. Default for ifstream and fstream.
  • static const fmtflags internal โ€” Adds fill characters at a designated internal point in certain generated output, or identical to right if no such point is designated.
  • static const fmtflags left โ€” Adds fill characters on the right (final positions) of certain generated output. (I.e., the thing you print is flush left.).
  • static const fmtflags oct โ€” Converts integer input or generates integer output in octal base.
  • static const openmode out โ€” Open for output. Default for ofstream and fstream.
  • static const fmtflags right โ€” Adds fill characters on the left (initial positions) of certain generated output. (I.e., the thing you print is flush right.).
  • static const fmtflags scientific โ€” Generates floating-point output in scientific notation.
  • static const fmtflags showbase โ€” Generates a prefix indicating the numeric base of generated integer output.
  • static const fmtflags showpoint โ€” Generates a decimal-point character unconditionally in generated floating-point output.
  • static const fmtflags showpos โ€” Generates a + sign in non-negative generated numeric output.
  • static const fmtflags skipws โ€” Skips leading white space before certain input operations.
  • static const openmode trunc โ€” Truncate an existing stream when opening. Default for ofstream.
  • static const fmtflags unitbuf โ€” Flushes output after each output operation.
  • static const fmtflags uppercase โ€” Replaces certain lowercase letters with their uppercase equivalents in generated output.

๐Ÿ”’ Protected Types ๐Ÿ”’

  • enum { _S_local_word_size }

๐Ÿ› ๏ธ Protected Member Functions ๐Ÿ› ๏ธ

these are the behind-the-scenes girlies, doing the actual work while the public API takes the credit ๐Ÿ’…

  • void _M_cache_locale (const locale &__loc)
  • void _M_call_callbacks (event __ev) throw ()
  • void _M_dispose_callbacks (void) throw ()
  • _Words & _M_grow_words (int __index, bool __iword)
  • void _M_init () throw ()
  • template<typename _ValueT> __ostream_type & _M_insert (_ValueT __v)
  • void _M_move (ios_base &) noexcept
  • void _M_swap (ios_base &__rhs) noexcept
  • void init (basic_streambuf< _CharT, _Traits > *__sb) โ€” All setup is performed here.
  • void move (basic_ios &&__rhs)
  • void move (basic_ios &__rhs)
  • void set_rdbuf (basic_streambuf< _CharT, _Traits > *__sb)
  • void swap (basic_ios &__rhs) noexcept
  • void swap (basic_ostream &__rhs)

๐Ÿซฃ Protected Attributes ๐Ÿซฃ

  • _Callback_list * _M_callbacks
  • const __ctype_type * _M_ctype
  • iostate _M_exception
  • char_type _M_fill
  • bool _M_fill_init
  • fmtflags _M_flags
  • locale _M_ios_locale
  • _Words _M_local_word [_S_local_word_size]
  • const __num_get_type * _M_num_get
  • const __num_put_type * _M_num_put
  • streamsize _M_precision
  • basic_streambuf< _CharT, _Traits > * _M_streambuf
  • iostate _M_streambuf_state
  • basic_ostream< _CharT, _Traits > * _M_tie
  • streamsize _M_width
  • _Words * _M_word
  • int _M_word_size
  • _Words _M_word_zero

๐Ÿ“– Detailed Description ๐Ÿ“–

template<typename _CharT, typename _Traits>
    class std::basic_ofstream< _CharT, _Traits >

"Controlling output for files." โ€” that's the whole vibe, bestie, it writes stuff to files, periodt ๐Ÿ’…

Template Parameters

  • _CharT โ€” Type of character stream.
  • _Traits โ€” Traits for character type, defaults to char_traits<_CharT>.

This class supports reading from named files, using the inherited functions from std::basic_ostream. To control the associated sequence, an instance of std::basic_filebuf is used, which this page refers to as sb. ๐Ÿฆ‹


๐Ÿงฌ Member Typedef Documentation ๐Ÿงฌ

__num_get_type

template<typename _CharT, typename _Traits> typedef num_get<_CharT,
    istreambuf_iterator<_CharT, _Traits> > std::basic_ios< _CharT, _Traits
    >::__num_get_type [inherited]

These are non-standard types. (yes, they said it themselves, not me ๐Ÿ™ˆ)

event_callback

typedef void(* std::ios_base::event_callback) (event __e, ios_base &__b, int
    __i) [inherited]

The type of an event callback function. ๐Ÿ”ฅ

Parameters

  • __e โ€” One of the members of the event enum.
  • __b โ€” Reference to the ios_base object.
  • __i โ€” The integer provided when the callback was registered.

Event callbacks are user defined functions that get called during several ios_base and basic_ios functions, specifically imbue(), copyfmt(), and ~ios().

fmtflags

typedef _Ios_Fmtflags std::ios_base::fmtflags [inherited]

This is a bitmask type. _Ios_Fmtflags is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type fmtflags are:

  • boolalpha
  • dec
  • fixed
  • hex
  • internal
  • left
  • oct
  • right
  • scientific
  • showbase
  • showpoint
  • showpos
  • skipws
  • unitbuf
  • uppercase
  • adjustfield
  • basefield
  • floatfield

iostate

typedef _Ios_Iostate std::ios_base::iostate [inherited]

This is a bitmask type. _Ios_Iostate is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type iostate are:

  • badbit
  • eofbit
  • failbit
  • goodbit

openmode

typedef _Ios_Openmode std::ios_base::openmode [inherited]

This is a bitmask type. _Ios_Openmode is implementation-defined, but it is valid to perform bitwise operations on these values and expect the Right Thing to happen. Defined objects of type openmode are:

  • app
  • ate
  • binary
  • in
  • out
  • trunc

seekdir

typedef _Ios_Seekdir std::ios_base::seekdir [inherited]

This is an enumerated type. _Ios_Seekdir is implementation-defined. Defined values of type seekdir are:

  • beg
  • cur, equivalent to SEEK_CUR in the C standard library.
  • end, equivalent to SEEK_END in the C standard library.

๐ŸŽ€ Member Enumeration Documentation ๐ŸŽ€

enum std::ios_base::event [inherited]

The set of events that may be passed to an event callback. erase_event is used during ~ios() and copyfmt(). imbue_event is used during imbue(). copyfmt_event is used during copyfmt().


โœจ Constructor & Destructor Documentation โœจ

basic_ofstream ()

template<typename _CharT, typename _Traits> std::basic_ofstream< _CharT,
    _Traits >::basic_ofstream () [inline]

Default constructor. Initializes sb using its default constructor, and passes &sb to the base class initializer. Does not open any files (you haven't given it a filename to open, so likeโ€ฆ what did you expect bestie ๐Ÿ˜ญ).

basic_ofstream (const char * __s, ios_base::openmode __mode = ios_base::out)

template<typename _CharT, typename _Traits> std::basic_ofstream< _CharT,
    _Traits >::basic_ofstream (const char * __s, ios_base::openmode __mode =
    ios_base::out) [inline],  [explicit]

Create an output file stream. ๐Ÿฆ‹

Parameters

  • __s โ€” Null terminated string specifying the filename.
  • __mode โ€” Open file in specified mode (see std::ios_base).

ios_base::out is automatically included in __mode.

basic_ofstream (const std::string & __s, ios_base::openmode __mode = ios_base::out)

template<typename _CharT, typename _Traits> std::basic_ofstream< _CharT,
    _Traits >::basic_ofstream (const std::string & __s, ios_base::openmode
    __mode = ios_base::out) [inline],  [explicit]

Create an output file stream. ๐Ÿฆ‹

Parameters

  • __s โ€” std::string specifying the filename.
  • __mode โ€” Open file in specified mode (see std::ios_base).

ios_base::out is automatically included in __mode.

basic_ofstream (const _Path & __s, ios_base::openmode __mode = ios_base::out)

template<typename _CharT, typename _Traits> template<typename _Path,
    typename _Require = _If_fs_path<_Path>> std::basic_ofstream< _CharT,
    _Traits >::basic_ofstream (const _Path & __s, ios_base::openmode __mode
    = ios_base::out) [inline]

Create an output file stream. ๐Ÿฆ‹

Parameters

  • __s โ€” filesystem::path specifying the filename.
  • __mode โ€” Open file in specified mode (see std::ios_base).

ios_base::out is automatically included in __mode.

~basic_ofstream ()

template<typename _CharT, typename _Traits> std::basic_ofstream< _CharT,
    _Traits >::~basic_ofstream () [inline]

The destructor does nothing. The file is closed by the filebuf object, not the formatting stream. (iconic delegation honestly ๐Ÿ‘‘)


๐Ÿ’– Member Function Documentation ๐Ÿ’–

_M_getloc

const locale & std::ios_base::_M_getloc () const [inline],  [inherited]

Locale access.

Returns

A reference to the current locale.

Like getloc above, but returns a reference instead of generating a copy.

Referenced by std::money_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::num_put< _CharT, _OutIter >::do_put(), std::time_put< _CharT, _OutIter >::do_put(), std::time_get< _CharT, _InIter >::get(), and std::time_put< _CharT, _OutIter >::put().

bad ()

template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
    _Traits >::bad () const [inline],  [nodiscard],  [inherited]

Fast error checking. โšก

Returns

True if the badbit is set.

heads up bestie: other iostate flags may also be set. don't assume bad() being true means nothing else is going on ๐Ÿ’€
  • Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry().

clear โ€” [Re]sets the error state ๐Ÿ’…

template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::clear (iostate __state = goodbit) [inherited]

Okay so this one resets the error state. Yes bestie, resets. It's the little broom that sweeps your stream's drama away. โœจ

  • Parameters
    • __state โ€” the new state flag(s) to set. Like, what you wanna set it to.

Peep std::ios_base::iostate for the possible bit values. Most users will not need to pass an argument โ€” fr, the default goodbit does the thing.

References: std::ios_base::badbit, exceptions(), rdbuf(), and rdstate().

Referenced by: std::basic_ios< char_type, traits_type >::exceptions(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::__detail::operator>>(), std::basic_istream< _CharT, _Traits >::putback(), rdbuf(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< char_type, traits_type >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().


close โ€” shutting the file, bye bestie ๐Ÿ‘‹

template<typename _CharT, typename _Traits> void std::basic_ofstream< _CharT, _Traits >::close () [inline]

Close the file. That's it, that's the whole vibe. It calls std::basic_filebuf::close(). And if that function fails? failbit gets set in the stream's error state. Noted. ๐Ÿ“Œ


copyfmt โ€” copy-paste but make it stream โœจ

template<typename _CharT, typename _Traits> basic_ios< _CharT, _Traits > & std::basic_ios< _CharT, _Traits >::copyfmt (const basic_ios< _CharT, _Traits > & __rhs) [inherited]

Copies fields of __rhs into this. It's giving "be like your bestie" energy.

  • Parameters
    • __rhs โ€” the source values for the copies.
  • Returns
    • A reference to this object. ๐Ÿซถ

So the tea is: all fields of __rhs are copied into this object, EXCEPT that rdbuf() and rdstate() stay exactly how they were. Untouched. Iconic. All values in the pword and iword arrays get copied too.

Before copying, every callback is invoked with erase_event. After copying, each (new) callback gets invoked with copyfmt_event. And the grand finale? Copying exceptions(). ๐ŸŽ€

References: basic_ios(), std::__addressof(), exceptions(), fill(), std::ios_base::flags(), std::ios_base::getloc(), std::ios_base::precision(), tie(), std::tie(), and std::ios_base::width().


eof โ€” fast error checking, part one ๐Ÿƒโ€โ™€๏ธ

template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::eof () const [inline], [nodiscard], [inherited]

  • Returns
    • true if the eofbit is set.
Heads up bestie: other iostate flags may also be set. Don't assume it's just the one. ๐Ÿ’€

exceptions (the const one) โ€” mask reveal ๐Ÿ‘‘

template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT, _Traits >::exceptions () const [inline], [nodiscard], [inherited]

Throwing exceptions on errors. Spicy. ๐ŸŒถ๏ธ

  • Returns
    • The current exceptions mask.

This changes nothing in the stream โ€” it's purely a read, no cap. See the one-argument version of exceptions(iostate) for the meaning of the return value, because that's where the actual lore lives.

Referenced by: clear(), and copyfmt().


exceptions (the iostate one) โ€” now we're throwing hands ๐Ÿ˜ค

template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::exceptions (iostate __except) [inline], [inherited]

Throwing exceptions on errors, but this time you're the one setting the rules.

  • Parameters
    • __except โ€” the new exceptions mask.

By default, error flags are set silently. So chill. But you can set an exceptions mask for each stream; if a bit in the mask becomes set in the error flags, then an exception of type std::ios_base::failure is thrown. ๐Ÿšจ

And here's the part that gets you: if the error flag is already set when the exceptions mask is added, the exception is thrown immediately. No waiting, no build-up. Try running the following under GCC 3.1 or later:
#include <iostream>
#include <fstream>
#include <exception>

int main()
{
    std::set_terminate (__gnu_cxx::__verbose_terminate_handler);

    std::ifstream f ("/etc/motd");

    std::cerr << "Setting badbit\n";
    f.setstate (std::ios_base::badbit);

    std::cerr << "Setting exception mask\n";
    f.exceptions (std::ios_base::badbit);
}

fail โ€” fast error checking, part two ๐Ÿ’€

template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::fail () const [inline], [nodiscard], [inherited]

  • Returns
    • true if either the badbit or the failbit is set.

Checking the badbit in fail() is historical practice โ€” it's a legacy thing, it's grandfathered in, we don't question it. And again: other iostate flags may also be set. ๐Ÿ‘€

Referenced by: std::basic_ios< char_type, traits_type >::operator bool(), std::basic_ios< char_type, traits_type >::operator!(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().


fill (the getter) โ€” what's the empty character, bestie? ๐ŸŒธ

template<typename _CharT, typename _Traits> char_type std::basic_ios< _CharT, _Traits >::fill () const [inline], [nodiscard], [inherited]

Retrieves the empty character. The filler. The padding icon. โœจ

  • Returns
    • The current fill character.

It defaults to a space (' ') in the current locale. Classic.

Referenced by: copyfmt(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.


fill (the setter) โ€” new filler just dropped ๐ŸŽ€

template<typename _CharT, typename _Traits> char_type std::basic_ios< _CharT, _Traits >::fill (char_type __ch) [inline], [inherited]

Sets a new empty character. Glow up for your padding.

  • Parameters
    • __ch โ€” the new character.
  • Returns
    • The previous fill character. So you can always swap back, we love a reversible queen. ๐Ÿ’…

The fill character is used to fill out space when P characters have been requested (e.g., via setw), Q characters are actually used, and Q<P. And yeah โ€” it defaults to a space (' ') in the current locale.


flags (the const one) โ€” format flag peek ๐Ÿ‘‘

fmtflags std::ios_base::flags () const [inline], [nodiscard], [inherited]

Access to format flags. The whole control panel, for input and output.

  • Returns
    • The format control flags for both input and output.

Referenced by: std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::num_put< _CharT, _OutIter >::do_put(), std::chrono::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, std::__detail::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.


flags (the setter) โ€” all at once, no crumbs ๐Ÿ˜ค

fmtflags std::ios_base::flags (fmtflags __fmtfl) [inline], [inherited]

Setting new format flags all at once. It's a full send.

  • Parameters
    • __fmtfl โ€” the new flags to set.
  • Returns
    • The previous format control flags.
This function overwrites all the format flags with __fmtfl. Every single one. So likeโ€ฆ know what you're doing before you do it. ๐Ÿ™ˆ

flush</flush>` โ€” synchronizing the stream buffer ๐Ÿ’ฆ

template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::flush () [inherited]

Synchronizing the stream buffer. Get it all out, bestie.

  • Returns
    • *this

If rdbuf() is a null pointer, changes nothing. Nothing to flush, nothing to see. If it is a real pointer? It calls rdbuf()->pubsync(), and if that returns -1, sets badbit. ๐Ÿ˜ญ

References: std::ios_base::badbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().

Referenced by: std::flush().


getloc โ€” locale access, who are you today? ๐ŸŒ

locale std::ios_base::getloc () const [inline], [nodiscard], [inherited]

Locale access. Asking the stream "so what locale are we in rn?"

  • Returns
    • A copy of the current locale.

If imbue(loc) has previously been called, then this function returns loc. Otherwise, it returns a copy of std::locale(), the global C++ locale. So if you never set one, you get the default. Simple as. โœจ

Referenced by: std::basic_ios< _CharT, _Traits >::copyfmt(), std::money_put< _CharT, _OutIter >::do_put(), std::basic_ios< _CharT, _Traits >::imbue(), std::chrono::operator<<(), std::operator>>(), std::operator>>(), and std::ws().


good โ€” fast error checking, the final boss โญ

template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT, _Traits >::good () const [inline], [nodiscard], [inherited]

  • Returns
    • true if no error flags are set.

A wrapper around rdstate. She's a vibe check, basically. ๐Ÿฆ‹

Referenced by: std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and std::__detail::operator>>().


imbue โ€” moving to a new locale, we're relocating ๐Ÿงณ

template<typename _CharT, typename _Traits> locale std::basic_ios< _CharT, _Traits >::imbue (const locale & __loc) [inherited]

Moves to a new locale. New city, new energy. ๐ŸŒˆ

  • Parameters
    • __loc โ€” the new locale.
  • Returns
    • The previous locale.

Calls ios_base::imbue(loc), and if a stream buffer is associated with this stream, calls that buffer's pubimbue(loc). Both of them. Everybody gets the memo. ๐Ÿ“ฌ

Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

References: std::ios_base::getloc(), std::ios_base::imbue(), and rdbuf().

Referenced by: std::chrono::operator<<().


init โ€” the protected setup arc ๐Ÿ”’

template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::init (basic_streambuf< _CharT, _Traits > * __sb) [protected], [inherited]

All setup is performed here. That's the whole job. It's called from the public constructor, it is not virtual, and it cannot be redefined. So don't try it, bestie, it's not that kind of function. ๐Ÿ’…

Referenced by: std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ifstream< char >::basic_ifstream(), std::basic_ios< char_type, traits_type >::basic_ios(), std::basic_istream< char_type, traits_type >::basic_istream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_istringstream< char >::basic_istringstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ostream< char_type, traits_type >::basic_ostream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_stringstream< char >::basic_stringstream(), std::basic_stringstream< char >::basic_stringstream(), and std::basic_stringstream< char >::basic_stringstream().


is_open โ€” is the file actually open tho? ๐Ÿคจ

template<typename _CharT, typename _Traits> bool std::basic_ofstream< _CharT, _Traits >::is_open () [inline], [nodiscard]

Wrapper to test for an open file. A little middleman, doing a little check-in. ๐Ÿซถ

  • Returns
    • rdbuf()->is_open()

That's it. That's the return. Straight from the buffer's mouth.


iword โ€” access to the integer array ๐Ÿ”ข

long & std::ios_base::iword (int __ix) [inline], [inherited]

Access to integer array. A little stash of integers you can do whatever you want with. Iconic, honestly.

  • Parameters
    • __ix โ€” index into the array.
  • Returns
    • A reference to an integer associated with the index.

The iword function provides access to an array of integers that can be used for any purpose. The array grows as required to hold the supplied index. All integers in the array are initialized to 0. โœจ

Important though: the implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference. It can move on you. Don't get attached. ๐Ÿ˜ญ

References: iword().

Referenced by: iword().

narrow โ€” squeezes characters ๐Ÿ’…

   template<typename _CharT, typename _Traits> char std::basic_ios< _CharT,
       _Traits >::narrow (char_type __c, char __dfault) const [inline],
       [inherited]

Okay so bestie, this one squeezes characters. It maps a character of char_type to a character of char, if possible.

Parameters

  • __c โ€” The character to narrow.
  • __dfault โ€” The character to narrow.

Returns

  • The narrowed character.

It returns the result of

std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)

Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html โ€” go read them, they're giving localization realness. โœจ


open (filesystem::path flavor) ๐Ÿฆ‹

   template<typename _CharT, typename _Traits> template<typename _Path>
       _If_fs_path< _Path, void > std::basic_ofstream< _CharT, _Traits >::open
       (const _Path & __s, ios_base::openmode __mode = ios_base::out) [inline]

Opens an external file. (Not me opening my DMs, but close.)

Parameters

  • __s โ€” The name of the file, as a filesystem::path.
  • __mode โ€” The open mode flags.

Calls std::basic_filebuf::open(__s,__mode|out). If that function fails, failbit is set in the stream's error state. No cap. ๐Ÿ’€


open (const char* flavor) ๐Ÿ”ฅ

   template<typename _CharT, typename _Traits> void std::basic_ofstream<
       _CharT, _Traits >::open (const char * __s, ios_base::openmode __mode =
       ios_base::out) [inline]

Opens an external file.

Parameters

  • __s โ€” The name of the file.
  • __mode โ€” The open mode flags.

Calls std::basic_filebuf::open(__s,__mode|out). If that function fails, failbit is set in the stream's error state.

Referenced by std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), and std::basic_ofstream< char >::open(). Okay so it's popular, periodt.


open (std::string flavor) ๐ŸŽ€

   template<typename _CharT, typename _Traits> void std::basic_ofstream<
       _CharT, _Traits >::open (const std::string & __s, ios_base::openmode
       __mode = ios_base::out) [inline]

Opens an external file.

Parameters

  • __s โ€” The name of the file.
  • __mode โ€” The open mode flags.

Calls std::basic_filebuf::open(s,mode|out). If that function fails, failbit is set in the stream's error state.


operator bool โ€” the quick-and-easy status check ๐Ÿ‘‘

   template<typename _CharT, typename _Traits> std::basic_ios< _CharT, _Traits
       >::operator bool () const [inline],  [explicit],  [nodiscard],
       [inherited]

The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) .... It's giving main character energy. โœจ


operator! โ€” also the quick-and-easy status check ๐Ÿ™ˆ

   template<typename _CharT, typename _Traits> bool std::basic_ios< _CharT,
       _Traits >::operator! () const [inline],  [nodiscard],  [inherited]

The quick-and-easy status check. This allows you to write constructs such as if (!a_stream) ... and while (a_stream) .... Same vibe, different operator. ๐Ÿ’œ


operator<< for manipulators (the __ios_type one) ๐Ÿ’…

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (__ios_type &(* __pf
       )(__ios_type &)) [inline],  [inherited]

Interface for manipulators. Manipulators such as std::endl and std::hex use these functions in constructs like "std::cout << std::endl". For more information, see the iomanip header. Iconic.


operator<< for manipulators (the __ostream_type one) ๐ŸŒˆ

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (__ostream_type &(*
       __pf )(__ostream_type &)) [inline],  [inherited]

Interface for manipulators. Manipulators such as std::endl and std::hex use these functions in constructs like "std::cout << std::endl". For more information, see the iomanip header. Twinning. ๐Ÿ‘ฏ


operator<< from another streambuf ๐Ÿฆ‹

   template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >
       & std::basic_ostream< _CharT, _Traits >::operator<< (__streambuf_type *
       __sb) [inherited]

Extracting from another streambuf.

Parameters

  • __sb โ€” A pointer to a streambuf

This function behaves like one of the basic arithmetic extractors, in that it also constructs a sentry object and has the same error handling behavior.

If __sb is NULL, the stream will set failbit in its error state.

Characters are extracted from __sb and inserted into *this until one of the following occurs:

  • the input stream reaches end-of-file,
  • insertion into the output sequence fails (in this case, the character that would have been inserted is not extracted), or
  • an exception occurs while getting a character from __sb, which sets failbit in the error state

If the function inserts no characters, failbit is set. So basically, no characters, no peace. ๐Ÿ˜ญ


operator<< (bool) โ€” integer arithmetic inserters ๐Ÿ“

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (bool __n) [inline],
       [inherited]

Integer arithmetic inserters.

Parameters

  • __n โ€” A variable of builtin integral type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting. So fancy. ๐Ÿ’…


operator<< (const void*) โ€” pointer arithmetic inserters โœจ

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (const void * __p)
       [inline],  [inherited]

Pointer arithmetic inserters.

Parameters

  • __p โ€” A variable of pointer type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< (double) โ€” floating point arithmetic inserters ๐Ÿ”ฅ

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (double __f) [inline],
       [inherited]

Floating point arithmetic inserters.

Parameters

  • __f โ€” A variable of builtin floating point type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< (float) โ€” floating point arithmetic inserters ๐ŸŒธ

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (float __f) [inline],
       [inherited]

Floating point arithmetic inserters.

Parameters

  • __f โ€” A variable of builtin floating point type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< (int) โ€” integer arithmetic inserters ๐Ÿ‘‘

   template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >
       & std::basic_ostream< _CharT, _Traits >::operator<< (int __n)
       [inherited]

Integer arithmetic inserters.

Parameters

  • __n โ€” A variable of builtin integral type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< for manipulators (the ios_base one) ๐Ÿ’œ

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (ios_base &(* __pf
       )(ios_base &)) [inline],  [inherited]

Interface for manipulators. Manipulators such as std::endl and std::hex use these functions in constructs like "std::cout << std::endl". For more information, see the iomanip header.


operator<< (long) โ€” integer arithmetic inserters ๐ŸŽ€

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (long __n) [inline],
       [inherited]

Integer arithmetic inserters.

Parameters

  • __n โ€” A variable of builtin integral type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< (long double) โ€” floating point arithmetic inserters ๐ŸŒˆ

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (long double __f)
       [inline],  [inherited]

Floating point arithmetic inserters.

Parameters

  • __f โ€” A variable of builtin floating point type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< (long long) โ€” integer arithmetic inserters ๐Ÿฆ‹

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (long long __n)
       [inline],  [inherited]

Integer arithmetic inserters.

Parameters

  • __n โ€” A variable of builtin integral type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< (short) โ€” integer arithmetic inserters ๐Ÿ’…

   template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >
       & std::basic_ostream< _CharT, _Traits >::operator<< (short __n)
       [inherited]

Integer arithmetic inserters.

Parameters

  • __n โ€” A variable of builtin integral type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.

References basic_ostream(), std::ios_base::badbit, std::ostreambuf_iterator< _CharT, _Traits >::failed(), std::ios_base::goodbit, std::num_put< _CharT, _OutIter >::put(), std::basic_ios< _CharT, _Traits >::setstate(), and std::use_facet(). Okay so it's got receipts. ๐Ÿงพ


operator<< (unsigned int) โ€” integer arithmetic inserters โœจ

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (unsigned int __n)
       [inline],  [inherited]

Integer arithmetic inserters.

Parameters

  • __n โ€” A variable of builtin integral type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< (unsigned long) โ€” integer arithmetic inserters ๐Ÿ”ฅ

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (unsigned long __n)
       [inline],  [inherited]

Integer arithmetic inserters.

Parameters

  • __n โ€” A variable of builtin integral type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< (unsigned long long) โ€” integer arithmetic inserters ๐ŸŒธ

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (unsigned long long
       __n) [inline],  [inherited]

Integer arithmetic inserters.

Parameters

  • __n โ€” A variable of builtin integral type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


operator<< (unsigned short) โ€” integer arithmetic inserters ๐Ÿ‘‘

   template<typename _CharT, typename _Traits> __ostream_type &
       std::basic_ostream< _CharT, _Traits >::operator<< (unsigned short __n)
       [inline],  [inherited]

Integer arithmetic inserters.

Parameters

  • __n โ€” A variable of builtin integral type.

Returns

  • *this if successful

These functions use the stream's current locale (specifically, the num_get facet) to perform numeric formatting.


precision() โ€” flags access ๐ŸŽ€

   streamsize std::ios_base::precision () const [inline],  [nodiscard],
       [inherited]

Flags access.

Returns

  • The precision to generate on certain output operations.

Be careful if you try to give a definition of precision here; see DR 189. (Not me giving definitions without checking DR 189. ๐Ÿ™ˆ)

Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), and std::chrono::operator<<().


precision(streamsize) โ€” changing flags ๐Ÿ’œ

   streamsize std::ios_base::precision (streamsize __prec) [inline],
       [inherited]

Changing flags.

Parameters

  • __prec โ€” The new precision value.

Returns

  • The previous value of precision().

put โ€” simple insertion ๐ŸŒˆ

   template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >
       & std::basic_ostream< _CharT, _Traits >::put (char_type __c) [inherited]

Simple insertion. That's it. That's the whole vibe. ๐Ÿ’…

Parameters

  • __c โ€” The character to insert.

Returns *this

Tries to insert __c.

Note: This function is not overloaded on signed char and unsigned char.

References std::ios_base::badbit, std::ios_base::goodbit, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().

Referenced by std::endl(), and std::ends().


๐Ÿ’– void *& std::ios_base::pword (int __ix) [inline], [inherited] ๐Ÿ’–

Access to void pointer array.

Parameters

  • __ix โ€” Index into the array.

Returns A reference to a void* associated with the index.

The pword function provides access to an array of pointers that can be used for any purpose. The array grows as required to hold the supplied index. All pointers in the array are initialized to 0.

The implementation reserves several indices. You should use xalloc to obtain an index that is safe to use. Also note that since the array can grow dynamically, it is not safe to hold onto the reference. So don't get too attached, bestie. ๐Ÿ’…


๐ŸŒธ template<typename _CharT, typename _Traits> basic_streambuf< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::rdbuf (basic_streambuf< _CharT, _Traits > * __sb) [inherited] ๐ŸŒธ

Changing the underlying buffer.

Parameters

  • __sb โ€” The new stream buffer.

Returns The previous stream buffer.

Associates a new buffer with the current stream, and clears the error state.

Due to historical accidents which the LWG refuses to correct, the I/O library suffers from a design error: this function is hidden in derived classes by overrides of the zero-argument rdbuf(), which is non-virtual for hysterical raisins. As a result, you must use explicit qualifications to access this function via any derived class. For example:

std::fstream     foo;         // or some other derived type
std::streambuf*  p = .....;

foo.ios::rdbuf(p);            // ios == basic_ios<char>

References clear().


๐Ÿฆ‹ template<typename _CharT, typename _Traits> __filebuf_type * std::basic_ofstream< _CharT, _Traits >::rdbuf () const [inline], [nodiscard] ๐Ÿฆ‹

Accessing the underlying buffer.

Returns The current basic_filebuf buffer.

This hides both signatures of std::basic_ios::rdbuf().


โœจ template<typename _CharT, typename _Traits> iostate std::basic_ios< _CharT, _Traits >::rdstate () const [inline], [nodiscard], [inherited] โœจ

Returns the error state of the stream buffer.

Returns A bit pattern (well, isn't everything?)

See std::ios_base::iostate for the possible bit values. Most users will call one of the interpreting wrappers, e.g., good().

Referenced by std::basic_ios< char_type, traits_type >::bad(), clear(), std::basic_ios< char_type, traits_type >::eof(), std::basic_ios< char_type, traits_type >::fail(), std::basic_ios< char_type, traits_type >::good(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ios< char_type, traits_type >::setstate(), and std::basic_istream< _CharT, _Traits >::unget().


๐ŸŽ€ void std::ios_base::register_callback (event_callback __fn, int __index) [inherited] ๐ŸŽ€

Add the callback __fn with parameter __index.

Parameters

  • __fn โ€” The function to add.
  • __index โ€” The integer to pass to the function when invoked.

Registers a function as an event callback with an integer parameter to be passed to the function when invoked. Multiple copies of the function are allowed. If there are multiple callbacks, they are invoked in the order they were registered.


๐Ÿ’œ template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp (off_type __off, ios_base::seekdir __dir) [inherited] ๐Ÿ’œ

Changing the current write position.

Parameters

  • __off โ€” A file offset object.
  • __dir โ€” The direction in which to seek.

Returns *this

If fail() is not true, calls rdbuf()->pubseekoff(off,dir). If that function fails, sets failbit.

References std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().


๐ŸŒˆ template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > & std::basic_ostream< _CharT, _Traits >::seekp (pos_type __pos) [inherited] ๐ŸŒˆ

Changing the current write position.

Parameters

  • __pos โ€” A file position object.

Returns *this

If fail() is not true, calls rdbuf()->pubseekpos(pos). If that function fails, sets failbit.

References std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::failbit, std::ios_base::out, std::basic_ios< _CharT, _Traits >::rdbuf(), and std::basic_ios< _CharT, _Traits >::setstate().


โญ fmtflags std::ios_base::setf (fmtflags __fmtfl) [inline], [inherited] โญ

Setting new format flags.

Parameters

  • __fmtfl โ€” Additional flags to set.

Returns The previous format control flags.

This function sets additional flags in format control. Flags that were previously set remain set.

Referenced by std::__detail::operator>>().


๐Ÿ’ซ fmtflags std::ios_base::setf (fmtflags __fmtfl, fmtflags __mask) [inline], [inherited] ๐Ÿ’ซ

Setting new format flags.

Parameters

  • __fmtfl โ€” Additional flags to set.
  • __mask โ€” The flags mask for fmtfl.

Returns The previous format control flags.

This function clears mask in the format flags, then sets fmtfl & mask. An example mask is ios_base::adjustfield.


๐Ÿ”ฅ template<typename _CharT, typename _Traits> void std::basic_ios< _CharT, _Traits >::setstate (iostate __state) [inline], [inherited] ๐Ÿ”ฅ

Sets additional flags in the error state.

Parameters

  • __state โ€” The additional state flag(s) to set.

See std::ios_base::iostate for the possible bit values.

Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_fstream< char >::close(), std::basic_ifstream< char >::close(), std::basic_ofstream< char >::close(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::getline(), std::getline(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::operator<<(), std::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::operator>>(), std::operator>>(), std::tr2::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_istream< _CharT, _Traits >::sync(), and std::ws().


๐ŸŒŸ bool std::ios_base::sync_with_stdio (bool __sync = true) [static], [inherited] ๐ŸŒŸ

Interaction with the standard C I/O objects.

Parameters

  • __sync โ€” Whether to synchronize or not.

Returns True if the standard streams were previously synchronized.

The synchronization referred to is only that between the standard C facilities (e.g., stdout) and the standard C++ objects (e.g., cout). User-declared streams are unaffected. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary


๐Ÿ’Ž template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >::pos_type std::basic_ostream< _CharT, _Traits >::tellp () [inherited] ๐Ÿ’Ž

Getting the current write position.

Returns A file position object.

If fail() is not false, returns pos_type(-1) to indicate failure. Otherwise returns rdbuf()->pubseekoff(0,cur,out).

References std::ios_base::cur, std::basic_ios< _CharT, _Traits >::fail(), std::ios_base::out, and std::basic_ios< _CharT, _Traits >::rdbuf().


๐Ÿซถ template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie () const [inline], [nodiscard], [inherited] ๐Ÿซถ

Fetches the current tied stream.

Returns A pointer to the tied stream, or NULL if the stream is not tied.

A stream may be tied (or synchronized) to a second output stream. When this stream performs any I/O, the tied stream is first flushed. For example, std::cin is tied to std::cout.

Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), and copyfmt().


๐ŸŽ€ template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits > * std::basic_ios< _CharT, _Traits >::tie (basic_ostream< _CharT, _Traits > * __tiestr) [inline], [inherited] ๐ŸŽ€

Ties this stream to an output stream.

Parameters

  • __tiestr โ€” The output stream.

Returns The previously tied output stream, or NULL if the stream was not tied.

This sets up a new tie; see tie() for more.


๐Ÿ’… void std::ios_base::unsetf (fmtflags __mask) [inline], [inherited] ๐Ÿ’…

Clearing format flags.

Parameters

  • __mask โ€” The flags to unset.

This function clears __mask in the format flags.


๐ŸŒธ template<typename _CharT, typename _Traits> char_type std::basic_ios< _CharT, _Traits >::widen (char __c) const [inline], [inherited] ๐ŸŒธ

Widens characters.

Parameters

  • __c โ€” The character to widen.

Returns The widened character.

Maps a character of char to a character of char_type.

Returns the result of

std::use_facet<ctype<char_type> >(getloc()).widen(c)

Additional l10n notes are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html

Referenced by std::endl(), std::basic_ios< char_type, traits_type >::fill(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::get(), std::basic_istream< char_type, traits_type >::getline(), std::getline(), std::getline(), std::operator<<(), std::operator<<(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::tr2::operator>>().


โœจ streamsize std::ios_base::width () const [inline], [nodiscard], [inherited] โœจ

Flags access.

Returns The minimum field width to generate on output operations.

Minimum field width refers to the number of characters.

Referenced by std::basic_ios< _CharT, _Traits >::copyfmt(), std::num_put< _CharT, _OutIter >::do_put(), std::operator>>(), and std::operator>>().


๐Ÿฆ‹ streamsize std::ios_base::width (streamsize __wide) [inline], [inherited] ๐Ÿฆ‹

Changing flags.

Parameters

  • __wide โ€” The new width value.

Returns: the previous value of width(). ๐Ÿ’–


write โ€” character string insertion ๐ŸŒˆ

template<typename _CharT, typename _Traits> basic_ostream< _CharT, _Traits >
& std::basic_ostream< _CharT, _Traits >::write (const char_type * __s,
streamsize __n) [inherited]

okay so this one is the character string insertion girly. she takes your characters and puts them into the stream. very straightforward, very demure.

Parameters

  • __s โ€” the array to insert, bestie.
  • __n โ€” maximum number of characters to insert.

Returns โ€” *this ๐Ÿซถ

here's the tea: characters get copied from __s and inserted into the stream until one of these things happens:

  • __n characters are inserted โœจ
  • inserting into the output sequence fails โ€” and in that case, badbit will be set in the stream's error state ๐Ÿ’€
Note: this function is not overloaded on signed char and unsigned char. like, at all. periodt.

xalloc โ€” access to unique indices ๐Ÿ‘‘

int std::ios_base::xalloc () [static],  [inherited]

Returns โ€” an integer different from all previous calls.

so this function returns a unique integer every single time you call it. you can use it for literally anything, but it's primarily intended to be a unique index for the iword and pword functions. the expectation is that an application calls xalloc in order to obtain an index in the iword and pword arrays that can be used without fear of conflict. no drama, no collisions. ๐Ÿงš

the implementation keeps a static variable that gets incremented and returned on each invocation. xalloc is guaranteed to return an index that's safe to use in the iword and pword arrays. it's giving reliable. ๐Ÿ’…


๐ŸŽ€ Member Data Documentation ๐ŸŽ€

these are the iconic static constants, the main characters of ios_base. buckle up bestie, there's a lot of them, and every single one comes with receipts (aka the "Referenced by" list, which we are keeping in full because we don't skip content around here). ๐Ÿ’–

std::ios_base::adjustfield ๐ŸŒธ

const fmtflags std::ios_base::adjustfield [static],  [inherited]

a mask of left|right|internal. useful for the 2-arg form of setf. ๐ŸŽฏ

Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::internal(), std::left(), and std::right().

std::ios_base::app ๐Ÿ“

const openmode std::ios_base::app [static],  [inherited]

seek to end before each write. every single write. she's thorough like that. โœจ

Referenced by std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_filebuf< _CharT, _Traits >::overflow(), and std::basic_filebuf< _CharT, _Traits >::xsputn().

std::ios_base::ate ๐Ÿฆ‹

const openmode std::ios_base::ate [static],  [inherited]

open and seek to end immediately after opening. not before each write โ€” that's app's job. ate just does it once, right at the open. ๐Ÿ’ซ

Referenced by std::basic_filebuf< _CharT, _Traits >::open().

std::ios_base::badbit ๐Ÿ’€

const iostate std::ios_base::badbit [static],  [inherited]

indicates a loss of integrity in an input or output sequence (like, say, an irrecoverable read error from a file). this is the "something is genuinely broken" flag. ๐Ÿ˜ญ

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::basic_ios< _CharT, _Traits >::clear(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_iostream< char_type, traits_type >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_iostream< char_type, traits_type >::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, char_traits< _CharT > >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::tellg(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().

std::ios_base::basefield ๐Ÿ‘‘

const fmtflags std::ios_base::basefield [static],  [inherited]

a mask of dec|oct|hex. useful for the 2-arg form of setf. pick your base, bestie. ๐Ÿ”ข

Referenced by std::dec(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), std::hex(), and std::oct().

std::ios_base::beg โญ

const seekdir std::ios_base::beg [static],  [inherited]

request a seek relative to the beginning of the stream. home base. ๐Ÿ 

Referenced by std::basic_filebuf< _CharT, _Traits >::seekpos().

std::ios_base::binary ๐ŸŒˆ

const openmode std::ios_base::binary [static],  [inherited]

perform input and output in binary mode (as opposed to text mode). and listen โ€” this is probably not what you think it is; see https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary. read the docs before you assume, i'm begging. ๐Ÿ™ˆ

Referenced by std::basic_filebuf< _CharT, _Traits >::showmanyc().

std::ios_base::boolalpha โœจ

const fmtflags std::ios_base::boolalpha [static],  [inherited]

insert/extract bool in alphabetic rather than numeric format. so true/false instead of 1/0. so much more readable, no cap. ๐Ÿ’…

Referenced by std::boolalpha(), std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::noboolalpha().

std::ios_base::cur ๐Ÿฆ‹

const seekdir std::ios_base::cur [static],  [inherited]

request a seek relative to the current position within the sequence. right here, right now energy. ๐Ÿ“

Referenced by std::basic_filebuf< _CharT, _Traits >::imbue(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_filebuf< _CharT, _Traits >::pbackfail(), std::basic_filebuf< _CharT, _Traits >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_istream< _CharT, _Traits >::tellg(), and std::basic_ostream< _CharT, _Traits >::tellp().

std::ios_base::dec ๐Ÿ”ข

const fmtflags std::ios_base::dec [static],  [inherited]

converts integer input or generates integer output in decimal base. base 10 supremacy, sorry not sorry. ๐ŸŽ€

Referenced by std::dec(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<, and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>.

std::ios_base::end ๐ŸŒธ

const seekdir std::ios_base::end [static],  [inherited]

request a seek relative to the current end of the sequence. go to the back of the line. ๐Ÿšช

Referenced by std::basic_filebuf< _CharT, _Traits >::open(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff().

std::ios_base::eofbit ๐Ÿซถ

const iostate std::ios_base::eofbit [static],  [inherited]

indicates that an input operation reached the end of an input sequence. we ran out of characters, bestie, that's it, that's the whole thing. ๐Ÿ˜ญ

Referenced by std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_date(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_time(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, char_traits< _CharT > >::peek(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, char_traits< _CharT > >::seekg(), std::basic_istream< _CharT, _Traits >::unget(), std::basic_istream< _CharT, char_traits< _CharT > >::unget(), and std::ws().

std::ios_base::failbit ๐Ÿ™ˆ

const iostate std::ios_base::failbit [static],  [inherited]

indicates that an input operation failed to read the expected characters, or that an output operation failed to generate the desired characters. like, the vibes were off. the operation didn't crash and burn, but it also didn't do the thing. ๐Ÿ’”

Referenced by std::basic_ostream< _CharT, _Traits >::sentry::sentry(), std::basic_fstream< char >::close(), std::basic_ifstream< char >::close(), std::basic_ofstream< char >::close(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ifstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::operator<<(), std::basic_iostream< char_type, traits_type >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_ostream< _CharT, _Traits >::seekp(), and std::basic_ostream< _CharT, _Traits >::seekp().

std::ios_base::fixed ๐Ÿ“Œ

const fmtflags std::ios_base::fixed [static],  [inherited]

generate floating-point output in fixed-point notation. that's it, that's the tweet. โœจ

Referenced by std::fixed(), and std::hexfloat().

std::ios_base::floatfield ๐ŸŽ€

const fmtflags std::ios_base::floatfield [static],  [inherited]

a mask of scientific|fixed. useful for the 2-arg form of setf. float girls, this one's for you. ๐Ÿ’œ

Referenced by std::defaultfloat(), std::fixed(), std::hexfloat(), and std::scientific().

std::ios_base::goodbit ๐ŸŒŸ

const iostate std::ios_base::goodbit [static],  [inherited]

indicates all is well. zero error flags set. the stream is thriving, hydrated, moisturized, in her lane, focused, flourishing. ๐Ÿ‘‘

Referenced by std::basic_istream< _CharT, _Traits >::sentry::sentry(), std::num_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get(), std::time_get< _CharT, _InIter >::do_get_monthname(), std::time_get< _CharT, _InIter >::do_get_weekday(), std::time_get< _CharT, _InIter >::do_get_year(), std::basic_ostream< _CharT, _Traits >::flush(), std::basic_iostream< char_type, traits_type >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::basic_istream< _CharT, _Traits >::get(), std::time_get< _CharT, _InIter >::get(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_istream< _CharT, _Traits >::ignore(), std::basic_iostream< char_type, traits_type >::operator<<(), std::basic_ostream< _CharT, _Traits >::operator<<(), std::basic_iostream< char_type, traits_type >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::basic_istream< _CharT, _Traits >::operator>>(), std::operator>>(), std::basic_istream< _CharT, _Traits >::peek(), std::basic_ostream< _CharT, _Traits >::put(), std::basic_istream< _CharT, _Traits >::putback(), std::basic_istream< _CharT, _Traits >::read(), std::basic_istream< _CharT, _Traits >::readsome(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::seekg(), std::basic_istream< _CharT, _Traits >::sync(), std::basic_istream< _CharT, _Traits >::unget(), and std::ws().

std::ios_base::hex ๐ŸŒˆ

const fmtflags std::ios_base::hex [static],  [inherited]

converts integer input or generates integer output in hexadecimal base. base 16, the cool kid base. ๐Ÿ”ฅ

Referenced by std::num_get< _CharT, _InIter >::do_get(), std::num_put< _CharT, _OutIter >::do_put(), and std::hex().

std::ios_base::in ๐Ÿšช

const openmode std::ios_base::in [static],  [inherited]

open for input. default for ifstream and fstream. come on in, the water's fine. ๐Ÿซถ

...and the roll call for the entry above keeps going, bestie, because this one is EVERYWHERE โ€” it's referenced by:

  • std::basic_fstream< char >::basic_fstream()
  • std::basic_fstream< char >::basic_fstream()
  • std::basic_fstream< char >::basic_fstream()
  • std::basic_ifstream< char >::basic_ifstream()
  • std::basic_ifstream< char >::basic_ifstream()
  • std::basic_ifstream< char >::basic_ifstream()
  • std::basic_istringstream< char >::basic_istringstream()
  • std::basic_stringbuf< char >::basic_stringbuf()
  • std::basic_stringstream< char >::basic_stringstream()
  • std::basic_filebuf< char_type, traits_type >::_M_set_buffer()
  • std::basic_fstream< char >::open()
  • std::basic_fstream< char >::open()
  • std::basic_fstream< char >::open()
  • std::basic_ifstream< char >::open()
  • std::basic_ifstream< char >::open()
  • std::basic_ifstream< char >::open()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow()
  • std::basic_filebuf< _CharT, _Traits >::pbackfail()
  • std::basic_streambuf< char_type, traits_type >::pubseekoff()
  • std::basic_streambuf< char_type, traits_type >::pubseekpos()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_istream< _CharT, _Traits >::seekg()
  • std::basic_streambuf< char_type, traits_type >::seekoff()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff()
  • std::basic_stringbuf< char >::seekoff()
  • std::basic_streambuf< char_type, traits_type >::seekpos()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos()
  • std::basic_stringbuf< char >::seekpos()
  • std::basic_filebuf< _CharT, _Traits >::showmanyc()
  • std::basic_stringbuf< char >::showmanyc()
  • std::basic_istream< _CharT, _Traits >::tellg()
  • std::basic_filebuf< _CharT, _Traits >::underflow()
  • std::basic_stringbuf< _CharT, _Traits, _Alloc >::underflow()
  • std::basic_filebuf< _CharT, _Traits >::xsgetn()

  • const fmtflags std::ios_base::internal [static], [inherited] โ€” drops fill characters at a designated internal point in certain generated output. And if there's no such designated point? It's literally identical to right. That's the whole vibe, no cap. Referenced by std::internal().
  • const fmtflags std::ios_base::left [static], [inherited] โ€” adds fill characters on the right (the final positions) of certain generated output. I.e., the thing you print is flush left. Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::left(), and std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator<<.
  • const fmtflags std::ios_base::oct [static], [inherited] โ€” converts integer input, or generates integer output, in octal base. Referenced by std::oct().
  • const openmode std::ios_base::out [static], [inherited] โ€” open for output. This is the default for ofstream and fstream. Referenced by std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_fstream< char >::basic_fstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ofstream< char >::basic_ofstream(), std::basic_ostringstream< char >::basic_ostringstream(), std::basic_stringbuf< char >::basic_stringbuf(), std::basic_stringstream< char >::basic_stringstream(), std::basic_filebuf< char_type, traits_type >::_M_set_buffer(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_fstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_ofstream< char >::open(), std::basic_filebuf< _CharT, _Traits >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::overflow(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbackfail(), std::basic_streambuf< char_type, traits_type >::pubseekoff(), std::basic_streambuf< char_type, traits_type >::pubseekpos(), std::basic_streambuf< char_type, traits_type >::seekoff(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekoff(), std::basic_stringbuf< char >::seekoff(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_ostream< _CharT, _Traits >::seekp(), std::basic_streambuf< char_type, traits_type >::seekpos(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::seekpos(), std::basic_stringbuf< char >::seekpos(), std::basic_ostream< _CharT, _Traits >::tellp(), and std::basic_filebuf< _CharT, _Traits >::xsputn().
  • const fmtflags std::ios_base::right [static], [inherited] โ€” adds fill characters on the left (the initial positions) of certain generated output. I.e., the thing you print is flush right. Referenced by std::right().
  • const fmtflags std::ios_base::scientific [static], [inherited] โ€” generates floating-point output in scientific notation. Referenced by std::hexfloat(), and std::scientific().
  • const fmtflags std::ios_base::showbase [static], [inherited] โ€” generates a prefix indicating the numeric base of generated integer output. Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::noshowbase(), and std::showbase().
  • const fmtflags std::ios_base::showpoint [static], [inherited] โ€” generates a decimal-point character unconditionally in generated floating-point output. Referenced by std::noshowpoint(), and std::showpoint().
  • const fmtflags std::ios_base::showpos [static], [inherited] โ€” generates a + sign in non-negative generated numeric output. Referenced by std::noshowpos(), and std::showpos().
  • const fmtflags std::ios_base::skipws [static], [inherited] โ€” skips leading white space before certain input operations. Referenced by std::noskipws(), std::__detail::operator>>(), std::philox_engine< uint_fast32_t, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85 >::operator>>, and std::skipws().
  • const openmode std::ios_base::trunc [static], [inherited] โ€” truncate an existing stream when opening. This is the default for ofstream.
  • const fmtflags std::ios_base::unitbuf [static], [inherited] โ€” flushes output after each output operation. Referenced by std::basic_ostream< _CharT, _Traits >::sentry::~sentry(), std::nounitbuf(), and std::unitbuf().
  • const fmtflags std::ios_base::uppercase [static], [inherited] โ€” replaces certain lowercase letters with their uppercase equivalents in generated output. Referenced by std::num_put< _CharT, _OutIter >::do_put(), std::nouppercase(), and std::uppercase().

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Generated automatically by Doxygen for libstdc++ from the source code.

Not a human, not a committee, not even a very caffeinated intern โ€” just Doxygen doing its little documentation thing off the source. Respect. ๐Ÿ’…

aaaand that's a wrap on the whole std::basic... _Traits >(3) page, bestie!! ๐ŸŽ€โœจ this one's a libstdc++ original, and yeah, it was auto-generated by Doxygen for libstdc++ straight from the source code โ€” so if you ever need to cite it, that's your source and version right there in the footer, with its own date line doing its thing. go forth and stream responsibly. ๐Ÿฆ‹๐Ÿ’–

๐Ÿ“ฆ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 ยท GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 ยท GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms