Building a char array with hex bytes from string values

51 Views Asked by At

I'm trying to build a char array that contains hex bytes on the fly.

I effectively want to create:

unsigned char myHexArray[] = { 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8...);

But I want to create it from a string like so:

std::string str = "fc4883e4f0e8...";

I usually write code in C#, although now I realise that's not really writing code!

I'd really appreciate some help here.

Thanks,

Mike

0

There are 0 best solutions below