ios_base::fmtflags type — Formatting flags
typedef . . . fmtflags; static const fmtflags boolalpha; static const fmtflags dec; static const fmtflags fixed; static const fmtflags hex; static const fmtflags internal; static const fmtflags left; static const fmtflags oct; static const fmtflags right; static const fmtflags scientific; static const fmtflags showbase; static const fmtflags showpoint; static const fmtflags showpos; static const fmtflags skipws; static const fmtflags unitbuf; static const fmtflags uppercase; static const fmtflags adjustfield; static const fmtflags basefield; static const fmtflags floatfield;
The fmtflags
type is an
integer, enum
, or bitmask type
(the exact type is implementation-defined) that represents
formatting flags for input and output. In the ios_base
class, several static constants
are also defined, which can be implemented as enumerated literals or
as explicit constants. Table
13-13 lists the flag literals.
Table 13-13. fmtflags literals
Literal name | Description |
---|---|
Reads and writes bool values as text, according to the locale | |
Reads and writes decimal integers | |
Writes floating-point values in fixed notation | |
Reads and writes hexadecimal integers | |
Aligns output to internal point (e.g., after
sign or | |
Left-aligns output | |
Reads and writes octal integers | |
Right-aligns output | |
Writes floating-point values in scientific notation | |
Writes a prefix for an integer radix ( e.g.,
| |
Writes decimal point, even if not needed | |
Writes plus sign ( | |
Skips whitespace before input | |
Flushes output after each operation | |
Uses uppercase in generated output (e.g.,
|
Some formatting items are Boolean: a flag is set or cleared.
For example, the uppercase
flag
can be set to perform output in uppercase (that is, the 0X
hexadecimal prefix or E
in scientific notation), or the flag can
be cleared for lowercase output. Other flags are set in
fields. You can set a field to one of a number
of values. Table
13-14 lists the field names, definitions, and the default
behavior if the field value is 0
.
Each field name is used as a mask for the two-argument form of the
ios_base::setf
function.
Table 13-14. fmtflags constants
Constant name | Value | Default |
---|---|---|
| | |
| | Output: |
| | |