I'm not 100% sure on what you want, because of the contents of your string bl.
Taking you literally:
std::string bl = "0xA0"; // ^ this is what you meant to write ("0x"+"A0" is actually adding pointers) std::vector<unsigned char> vect; vect.insert(vect.begin(), bl.begin(), bl.end()); // ^ you use ranges with .insert not push_back
Or you can use the constructor:
std::string bl = "0xA0"; std::vector<unsigned char> vect(bl.begin(), bl.end()); // ^ you use ranges with the constructor too
In both these cases, the vector contains the characters '0', 'x', 'A' and '0'.
Alternatively, you might have meant for the string to contain the single character whose ASCII value is (in hex) 0xA0. If so, "0x"+"a0" is very wrong.
std::string bl = "\xA0"; std::vector<unsigned char> vect(bl.begin(), bl.end());
The vector contains one character, whose ASCII value is 0xA0.
I hope this helps.
std::vectorvectis not valid C++ code. Please specificstd::vector<T>for some typeT. Then, what values of typeTdo you expect the string bl to be converted into?