Converting a argc / argv construct into a va_list
I'm new here, so appologies for my first post being a request!!
I was wondering if anyone can help, I want to write a piece of code that converts an argc / argv to a variable argument list.
Basically I want to do something like the following
Unfortunatly I need to stick with argc / argv prototype
print_args(int argc, char *argv)
// first arg fmt string, subsequent args
if(argc == 1)
printf(argv); // assumes nothing to be substituted
else if (argc == 2)
printf(argv, argv) ;
else if (argc == 3)
printf(argv, argv, argv) ;
What I was wondering is if I could write something to create a va_list and call vprintf?
Anyone know if this is possible?
Thanks in advance