4 ms·
I thought I knew printf format strings, but I suppose not because I have no idea what %1$.*1$d %2$hn does. Can anyone explain why that increments the value behi
by vortico 9y ago
I thought I knew printf format strings, but I suppose not because I have no idea what %1$.*1$d %2$hn does. Can anyone explain why that increments the value behind a pointer?
- userbinator 9y agoThe trick is in the 'n' conversion specifier: http://pubs.opengroup.org/onlinepubs/009695399/functions/fprintf.html http://pubs.opengroup.org/onlinepubs/009695399/functions/fpr... "The argument shall be a pointer to an integer into which is written the number of bytes written to the output so far by this call to one of the fprintf() functions. No argument is converted." The * parameter provides the "input", since it allows controlling the number of bytes written with its parameter, which is then written to the n parameter.