Some useful printf format specificators
Jun 24, 2013 00:00 · 58 words · 1 minute read
There are some useful format specificators for 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", requred_len, string) )
%.0d - Print nothing for zero
%#x - Print a leading 0x
See the MSDN documentation for printf format specification.