hello all,
Iam trying to use a character string as hexadecimal.
for example i have a char array[] = "00001767fb693bc7"
the array represents character but these are hexadecimal characters each one.
now using memcpy i want to copy to one pointer variable like below
unsing char *p;
.
.
.
memcpy(p,array,8);
but its not getting me correct result.
result should be the same like below if do .
Code:
unsigned char mac1 = 0x00;
unsigned char mac2 = 0x00;
unsigned char mac3 = 0x17;
unsigned char mac4 = 0x67;
unsigned char mac5 = 0xfb;
unsigned char mac6 = 0x69;
unsigned char mac7 = 0x3b;
unsigned char mac8 = 0xc7;
syslog(LOG_ERR,"Changed the mac address -3 ");
memcpy(p, &mac1, 1);
p++;
memcpy(p, &mac2, 1);
p++;
syslog(LOG_ERR,"Changed the mac address -4 ");
memcpy(p, &mac3, 1);
p++;
memcpy(p, &mac4, 1);
p++;
memcpy(p, &mac5, 1);
p++;
syslog(LOG_ERR,"Changed the mac address -5 ");
memcpy(p, &mac6, 1);
p++;
memcpy(p, &mac7, 1);
p++;
syslog(LOG_ERR,"Changed the mac address -6 ");
memcpy(p, &mac8, 1);
p++;*/
can any body help me here , you help would be highly appreciated.