I'm trying hard to convert char *macAddress into unsigned char mac[6] but without success so far. My input string looks like "00:10:6f:16:01:b3" and I want to devide it into mac[0] = 0x00, mac[1] = 0x10, etc..
I've tried to use memcpy like:
memcpy(&mac, (unsigned char)macAddress, sizeof mac);
or same another ways like mac = (unsigned char *)macAddress and so on but nothing worked for me well.
Is there any correct way how to convert it without any precision loss?
(unsigned char)macAddress?? What makes you think you need or should cast a pointer to anunsigned char??memcpyis a C function. Where is you rminimal reproducible example and which language do you use? Remove the tag for the unrelated language.