cjlano / tinyprintf

A tiny printf and sprintf library for small embedded systems
http://www.sparetimelabs.com/tinyprintf/index.html
BSD 3-Clause "New" or "Revised" License
227 stars 61 forks source link

Support commas? #16

Open simonhf opened 4 years ago

simonhf commented 4 years ago

I tried changing the test file to:

#include <locale.h>
...
setlocale(LC_NUMERIC, "");
TPRINTF("%'llu\n", ULLONG_MAX);

But the output is:

$ make
...
libc_printf("%'llu\n", ULLONG_MAX) -> 18,446,744,073,709,551,615
 tfp_printf("%'llu\n", ULLONG_MAX) -> llu
...

The commas display for glibc as expected, but not for tfp. Any chance of adding comma support? Or at least understanding the ' character even if commas are not printed? If the locale stuff is too OTT for tinyprintf(), how about enabling comma support via an environment variable instead?

saintedlittle commented 1 month ago

https://github.com/saintedlittle/tinyprintf