I have
unsigned char src_mac[6];
that holds values with the %02x format.For example to find the value in src_mac[0] i do:
printf("%02x\n",src_mac[0]);
I want to know how to put values in src_mac(I need to put a mac adress saved as a string into src_mac and then put the mac adress into a ether_arp structure.
Editing my answer... i misread it
Anyway, try this sscanf
with hhx
as parameters... it means it will read an hex value and will store it as a char (unlikely the default that store the value as int)
sscanf(string_mac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &src_mac[5], &src_mac[4], &src_mac[3],
&src_mac[2], &src_mac[1], &src_mac[0]);