std::setbase (3) - Linux Manuals
std::setbase: std::setbase
NAME
Synopsis
Defined in header <iomanip>
/*unspecified*/ setbase( int base );
Sets the numeric base of the stream. When used in an expression out << setbase(base) or in >> setbase(base), changes the basefield flag of the stream out or in, depending on the value of base:
* the value 16 sets basefield to std::ios_base::hex
* the value 8 sets std::ios_base::oct
* the value 10 sets std::ios_base::dec.
Values of base other than 8, 10, or 16 reset basefield to zero, which corresponds to decimal output and prefix-dependent input.
Parameters
base - new value for basefield
Return value
Returns an object of unspecified type such that if str is the name of an output stream of type std::basic_ostream<CharT, Traits> or std::basic_istream<CharT, Traits>, then the expression str << setbase(base) or str >> setbase(base) behaves as if the following code was executed:
Example
// Run this code
Output:
See also
dec changes the base used for integer I/O
hex (function)
oct
showbase (function)
noshowbase