When basefield is set to dec, integral numerical values inserted into the stream are expressed in the decimal base (radix 10). For input streams, extracted values are also expected to be expressed in the decimal base when this flag is set.
The basefield format flag can take any of the following values (each with its own manipulator):
| flag value | effect when set |
|---|---|
| dec | read/write integral values using decimal base format. |
| hex | read/write integral values using hexadecimal base format. |
| oct | read/write integral values using octal base format. |
The basefield flag is set to dec in standard streams on initialization.
Parameters
- str
- Stream object where to apply.
Because this function is a manipulator, it is designed to be used alone with no arguments in conjunction with the insertion (<<) and extraction (>>) operations on streams (see example below).
Return Value
A reference to the stream object.Example
| 1 2 3 4 5 6 7 8 9 10 11 12 |
|
The execution of this example displays something similar to:
70 46 106 |
See also
| hex | Use hexadecimal base (manipulator function) |
| oct | Use octal base (manipulator function) |
| ios_base::flags | Get/set format flags (public member function) |
| ios_base::setf | Set specific format flags (public member function) |
