Skip to content

Serialcomms/printf_unsigned_integer_with_commas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Printf integer with commas

Simple C-Language utility to add commas to large integer values when printing from printf, e.g.

standard printf output :-
total bytes=7580677 used bytes=2535702

with commas printf output :-
total bytes=7,580,677 used bytes=2,535,702

Two versions are offered here

1. void printf_uint_commas(uint unsigned_integer);

prints the supplied uint in comma-formatted style to stdio.

2. void snprintf_uint_commas(uint unsigned_integer, char printf_result[14U]);

populates the printf_result buffer with comma-formatted result;

developer can then use a regular printf to output the result.

Initial testing with Raspberry Pico SDK only.

Note that printf implementations can and do vary between platforms, and further testing is therefore recommended.

About

Simple C printf function to format an unsigned integer with commas

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages