I have an _u8 Array with hexadecimals in it, in the form of: A81B6A9D4D2E for example. And I want to turn it into an string in the form of: A8-1B-6A-9D-4D-2E and have it as a string to send it.
#define SL_MAC_ADDR_LEN UINT8_C(6)
_u8 wlanMacAddressVal[SL_MAC_ADDR_LEN];
I can print it with a Loop as following:
for(int i = 0; i < SL_MAC_ADDR_LEN; i++){
printf(%X, wlanMacAddressVal[i]);
printf("-");
}
But when I try to make a string/chararray and using the strcat Function my results are always weird symbols.
I've tried using sprintf() in the loop, but it always overwrites the last hexadecimals
sprintf(wlanMacString,"%X",(_u8 *)wlanMacAddressVal[i]);