I have done some research on how to convert an int to Hex string and found an answer, however what i need is a little bit different as you can see in the following code:
int addr = 5386; //
std::string buffer = "contains 0xCCCCCCCC as hex (non ASCII in the string)";
size_t idx = 0;
idx = buffer.find("\xCC\xCC\xCC\xCC", idx);
if (idx != string::npos) buffer.replace(idx, 4, XXX); // here i want to put the addr variable but as 0x0000150A
What i need is a way to convert the addr
variable to a hex string that has the \x
in between the bytes like "\x0a\x15\x00\x00"
Thanks in advance.