Input Stream Manipulators

Many manipulators, such as setprecision, are defined for the ios class and thus technically apply to input streams. Few manipulators, however, actually affect input stream objects. The most important are the manipulators dec, oct, and hex. These radix manipulators determine the conversion base used with numbers from the input stream.

On extraction, the hex manipulator enables the processing of a variety of input formats. For example, the sequences c, C, 0xc, 0xC, 0Xc, and 0XC are all interpreted as the decimal integer 12. Any character other than 0 through 9, A through F, a through f, x, and X terminates the numeric conversion. Thus the sequence "124n5" is converted to the number 124 with the ios::fail bit set in the process.