I have a string like
string test = "48656c6c6f20576f726c64"; 
and I would like to convert it to
unsigned char state[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 
                           0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
unsigned char bytearray[60];
int w;
for (w=0;w<str.length();w+2) {
    bytearray[w] = "0x" + str2[w];  
}
It doesn't seem to work. Any help would be appreciated
 
     
     
    