I created a vector std::vector<uint8_t> vec{ 0x0C, 0x14, 0x30 };
I want to return the values of the vector in a string "0CD430".
I created this simple code:
std::string vectorTostring(const std::vector<uint8_t>& vec)
{
std::string result;
for (const auto& v : vec)
{
result += std::to_string(v);
}
return result;
}
in this case the result will be "122048". Wow the hex values are stored in the vector of bytes and why I got the decimal value and not the hex value using to_string?