Support Forums
how to chang mac to string or text
max

I can get the MAC by MacInfo=MACID();
But I dont know the data type of mac, how can I change it to string or text ? use BuffToArray or other func ? thank you.

str = BuffToArray(data[0],
6 ,
MacInfo[1][0] ,
0 ,
5 ,
1,
0 { Don't skip anything });

I can get the MAC by MacInfo=MACID(); But I dont know the data type of mac, how can I change it to string or text ? use BuffToArray or other func ? thank you. str = BuffToArray(data[0], 6 , MacInfo[1][0] , 0 , 5 , 1, 0 { Don't skip anything });

@Dave - VTScada
Thank you. But I haven`t got the result I wished. Whoud you like to give me a demo that show the MAC with ZText function ?

@Dave - VTScada Thank you. But I haven`t got the result I wished. Whoud you like to give me a demo that show the MAC with ZText function ?

The MAC is a string of binary values. You can use BuffToHex to convert it to hex characters, e.g.

TextMac = \System.BufftoHex(Mac[1][0]);

If you want to format it to be more readable, e.g. with ":" separators, then either loop around the bytes or break then out separately, e.g.

TextMac = BuffStream("");
SWrite(TextMac, "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x",
                GetByte(Mac[1][0], 0), GetByte(Mac[1][0], 1),
                GetByte(Mac[1][0], 2), GetByte(Mac[1][0], 3),
                GetByte(Mac[1][0], 4), GetByte(Mac[1][0], 5));
The MAC is a string of binary values. You can use BuffToHex to convert it to hex characters, e.g. TextMac = \System.BufftoHex(Mac[1][0]); If you want to format it to be more readable, e.g. with ":" separators, then either loop around the bytes or break then out separately, e.g. TextMac = BuffStream(""); SWrite(TextMac, "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", GetByte(Mac[1][0], 0), GetByte(Mac[1][0], 1), GetByte(Mac[1][0], 2), GetByte(Mac[1][0], 3), GetByte(Mac[1][0], 4), GetByte(Mac[1][0], 5));

Software Developer with Trihedral

57
4
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft