IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

hexBinary Options · View
xmlhack
Posted: Thursday, April 19, 2018 6:23:45 PM
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>



xmlhack
Posted: Tuesday, April 24, 2018 4:08:22 PM
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;
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.