11 Years
Discussion Span
Last Post by WaltP

I would think sprintf() is as much C++ as null terminated char arrays are. However, if you don't like using C style I/O and all you want to do is to see the hex equivalent of a value, not manipulate the hex equivalent of a value, then there is a stream flag/modifier by the name of hex that can be used to view the value of a numeric variable as hex as opposed to dec.


>that's c not c++
sprintf is C++ too.

>do u know anyother sol. in c++
Yes, use the hex manipulator with either cout or a string stream. Alternatively, you can do the conversion manually, but since that's available in C as well, I guess it doesn't count as C++. :icon_rolleyes:

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.