What is the best way to convert a variable length hex string e.g. \"01A1\" to a byte array containing that data.
\"01A1\"
i.e converting this:
st
i've modified TheoretiCAL's code
uint8_t buf[32] = {}; std::string hex = "0123"; while (hex.length() % 2) hex = "0" + hex; std::stringstream stream; stream << std::hex << hex; for (size_t i= 0; i > buf[i];