How to convert a MAC address (in string) to array of integers?

Viewed 26289

How do I convert a MAC address within a string to an array of integers in C?

For example, I have the following string that stores a MAC address:

00:0d:3f:cd:02:5f

How do I convert this to:

uint8_t array[6] = {0x00, 0x0d, 0x3f, 0xcd, 0x02, 0x5f}
2 Answers
Related