Condividi tramite


Input Stream Manipulators

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

On extraction, the hex manipulator enables processing of various input formats. For example, 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 basic_ios::fail bit set.

See Also

Reference

Input Streams