This question is related to: Get number of characters read by sscanf? however, it asks specifically how to wrap the variadic arguments (C++11 variadic templates) to achieve the effect.
I would like to have a function:
int my_sscanf( int& ncharswritten, const char* str, const char* fmt, ... )
{
}
which returns the normal number of format things specified, but furthermore (as a reference argument for example) returns the number of characters written.
As noted in the above link, the suggested solution to know number of characters written is to use the %n at the end of the fmt. The question is how to achieve this in real life without having to add that to fmt manually each time.