Hi
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 prototypeCode:void print_args(int argc, char *argv[]) // first arg fmt string, subsequent args { if(argc == 1) printf(argv[1]); // assumes nothing to be substituted else if (argc == 2) printf(argv[1], argv[2]) ; else if (argc == 3) printf(argv[1], argv[2], argv[3]) ; // etc. }
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
Craig



LinkBack URL
About LinkBacks


