Some useful printf format specifiers
Jun 24, 2013 00:00 · 61 words · 1 minute read
There are some useful format specifiers for the printf and wprintf functions.
%04x - 4-digit hex number with leading zeros
%*d - Runtime width specifier (e.g. printf("%*d%s", required_space, value) )
%.*s - Print a substring (e.g. printf("%.*s", required_len, string) )
%.0d - Print nothing for zero
%#x - Print a leading 0x
See the Microsoft documentation for the printf format specification.