I am trying to convert an unsigned short to its hexadecimal representation in uppercase and prefixed with 0's using stringstream. I can't seem to get the uppercase and 0's correct. here is what I have now:
USHORT id = 1127;
std::stringstream ss;
ss << std::showbase << std::uppercase << std::setfill('0') << std::setw(4) << std::hex << id;
std::string result = ss.str();
this results in the prefixed '0x' base also being uppercase but I want that to be lowercase. it also results in no prefixed 0's to the hexadecimal value after the prefixed 0x base (currently 0X). for example, this will now output 0X467 instead of the expected 0x0467. how do I fix this?