I have a character array (an ethernet address like aa:bb:cc:dd:ee:ff) that I need to parse up into an unsigned char[6].  I'm using strtok to get each pair of characters, and I need to cast them into an unsigned char, but nothing I'm doing is working.
I've tried (assume c is a char* of length 2):
unsigned char t = (unsigned char)c;  // gives "loses precision" error
unsigned char* t = (unsigned char*)c;
unsigned char t1 = t[0];                  // gives the wrong value
unsigned char t;
strcpy((char*)t, c);      // gives the wrong value
strncpy((char*)t, c, sizeof(char)*2) // gives the wrong value
 
     
     
    