« Close

Datasheets and User Guides

App Notes

Software & Driver

 

2.6.6 - MACToNumber

Takes a hex-colon string representing a MAC address and outputs the corresponding integer version of the address.

Syntax

LJM_ERROR_RETURN LJM_MACToNumber(
                      const char * MACString, 
                      unsigned long long * Number)

Parameters

MACString [in]
A hex-colon string representing a MAC address.
Number [out]
The numerical representation of MACString.

Returns

LJM errorcodes or 0 for no error. Returns LJME_INVALID_PARAMETER if MACString could not be parsed as a MAC address.

Remarks

Use this function to convert a human-readable interpretation of a MAC address into an integer value.

Examples

[C/C++] Convert a MAC string into a number.

int LJMError;
unsigned long long Number;
 
LJMError = LJM_MACToNumber("78:45:C4:26:89:4A", &Number);
printf ("%llu \n", Number);
// prints 81952921372024