I'm interested in using function(specifier, ...);
style variable-parameter functions in C for other purposes than fancy printing or specified format readout.
Examples may include custom database columns, passing variable parameters to functions that can serialize them depending on content, and many others.
I know of the basic use:
char buffer[BUF_SIZE]
va_list args;
va_start(args, format);
vsnprintf(buffer, BUF_SIZE-1, format, args);
va_end(args);
This is not what I'm asking about.
Lets imagine I want to cook my own printf, which uses vastly different format, say, instead of format string it uses format list - an array of enums specifying types, or some other way to specify what exactly is being loaded into the ...
- nothing even register_printf_function
-> could help me with, and for one reason or another I'm unwilling to try to build a format string from the data provided.
So, how would I go about accessing the data from the extra ellipsis (instead of passing it blindly to a magical vprintf without ever peering inside it)?