Rank: Newbie
Joined: 4/19/2018 Posts: 2 Location: US
|
I have mapforce 2016 and MS VS 2010.
How do I convert a UUID of type string to hexBinary?
For example, I want to convert the string from:
"BB08000000000000000000000000000000"
to
BB08000000000000000000000000000000
I can get it to the hex representation (E.g., 42424F.......) using std::vector<unsigned char>
|
Rank: Newbie
Joined: 4/19/2018 Posts: 2 Location: US
|
I got this to work. Probably not 100% syntactically correct, but gives me what I want.
std::vector<unsigned char> data; unsigned char c, d, c_hex, d_hex;
for ( unsigned int i = 0; i < uuid.length(); i++) { c = (unsigned char) uuid[i]; d = (unsigned char) uuid[i+1];
c_hex = (int)strtol((const char *)&c, NULL, 16); d_hex = (int)strtol((const char *)&d, NULL, 16);
c_hex <<= 4; c_hex |= d_hex;
data.push_back(c_hex); i++; }
return data;
|