Weirdness with sprintf

Hey any idea why this does not work properly?

char addrStr[18];
byte addr[6];
WiFi.macAddress(addr);
sprintf(addrStr,"%02X-%02X-%02X-%02X-%02X-%02X",addr[0],addr[1],addr[2],addr[3],addr[4],addr[5]);

I have tried casts (unsigned int) (unsigned char) etc nothing works what happens is the first 3 or 4 bytes of the address get converted properly to string values then it goes haywire.

I have a work around to this problem by converting each byte to char* and writing the characters individually into addrStr but that is super hookie. Any ideas? Am I doing something wrong?

Hi @HardWater

Is this on a Photon or a Core? I think there are some issues with sprintf on the Photon right now, but I thought the issues were confined to floating-point.

Hi @bko

Actually it is on both I implemented my workaround on the Core and figured I would get rid of it and go to something more normal when making mods for the Photon but I see I still get the same Weirdness exists on the Photon.

Yeah I already ran into that issue with sprintf("%f"), but no this is an old problem. By old I mean 3-4 weeks ago when I implemented the workaround on the Core.