Jump to main content

##

# TCPIP_Helper_StringToMACAddress Function

## C

    bool TCPIP_Helper_StringToMACAddress(
        const char* str,
        uint8_t macAddr[6]
    );

## Description

This function parses a MAC address string "aa:bb:cc:dd:ee:ff" or "aa-bb-cc-dd-ee-ff" into an hex MAC address.

## Preconditions

macAddr - valid pointer to a 6 byte MAC address field.

## Parameters

Parameters | Description
--- | ---
str | Pointer to a colon separated MAC address string.
macAddr | Pointer to buffer to store the result.

## Returns

- True - A MAC address was successfully decoded.
- False - No MAC address could be found, of the format was incorrect.

## Remarks

If str == NULL or strlen(str) == 0, the result will be address 0.