When working with string streams and strings, how do you attain the same affect as the %02x format code from C?
I want to take a byte of data and store it as its hexidecimal equivilent in ASCII into either a string or string stream.
When working with string streams and strings, how do you attain the same affect as the %02x format code from C?
I want to take a byte of data and store it as its hexidecimal equivilent in ASCII into either a string or string stream.
You would use the std::hex manipulator for the hex output, std::setw(2) to set the field width to 2, and std::setfill('0') to set the fill character to '0'.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)