3 ms·
You'd probably want "%.*s" or possibly even "%*.*s" if you want it space padded. In principle you can bound your space usage and avoid an snprintf
by dllthomas 13y ago
You'd probably want
"%.*s"
or possibly even
"%*.*s"
if you want it space padded. In principle you can bound your space usage and avoid an snprintf with such constructs; in practice, it's probably better to still use snprintf (if you're using standard-library string functions at all).