I’m trying to convert an integer to a little endian hex string. I can get to a little endian hex long but I’m not sure how to convert to string from there.
int iNum = 17706;
// convert to long little endian hex
long lNum = (long)_byteswap_ushort(iNum);
// convert to string??
Alternatively, is there a way to go straight from an integer to little endian hex string?
Thanks.
Use
std::stringstreamto format strings.Also, use
_byteswap_ulongor large ints will not be accurate.