I have a module with a a variable number of parameters:
int myprintf( const char *format, ... ){
}
I want to declare a local char array, pass the "myprint" parameters to sprintf() so that sprintf() converts the parameters to a character array then I can do something with that character array. By doing this, I do not have to re-invent the internals of sprintf.
In theory:
int myprintf( const char *format, ... )
{
char buf[ 512 ];
sprintf( buf, format, ... );
// now do something with buf
}
I am sure va_start( a, b)
, va_arg( c, d )
will have something to do with it; but va_arg seems to need parse the original argument list.
Any suggestions?