The basefield flag is used in certain input and output operations to determine the numeric base to be used to interpret numeric values.
This manipulator is declared in header <iomanip>, along with the other parameterized manipulators: resetiosflags, setiosflags, setfill, setprecision and setw. This header file declares the implementation-specific smanip type, plus any additional operator overload function needed to allow these manipulators to be inserted and extracted to/from streams with their parameters.
Parameters
- base
- Numerical radix to be used.
This value should be 8, 10 or 16.
Return Value
Unspecified. This function should only be used as a stream manipulator.Example
| 1 2 3 4 5 6 7 8 9 10 |
|
This code uses the setbase manipulator to set hexadecimal as the basefield flag. The output of this example is the hexadecimal value of 100, i.e. 64.
See also
| oct | Use octal base (manipulator function) |
| dec | Use decimal base (manipulator function) |
| hex | Use hexadecimal base (manipulator function) |
| ios_base::flags | Get/set format flags (public member function) |
