monkeyboard / Wiegand-Protocol-Library-for-Arduino

Wiegand 26 and Wiegand 34 Protocol Library for Arduino
323 stars 131 forks source link

Missing leading zeros #66

Open Secarius opened 8 months ago

Secarius commented 8 months ago

Hi, how can i display the leading zeros? I have a tag with 10 digits (Wiegand34) and i would like to get the leading zeros printed:

Instead of: HEX = F225C, DECIMAL = 991836, Type W34 I would like to have it like this: HEX = 000F225C, DECIMAL = 0000991836, Type W34

So that the Output would be the same length every time: Wiegand1 HEX = DF125A85, DECIMAL = 3742521989, Type W34

Would that be possible?

jpliew commented 8 months ago

Hi,

Please refer to printf function or this link https://www.w3resource.com/c-programming-exercises/c-snippets/printing-with-leading-0s-in-c.php