I need to write a function that has the same parameters as printf(), eg. my_printf(char*, ...), that will perform some minor operations and then call the printf() function. What is the correct way to define my function so that I can then pass the parameters to printf()? Put another way, what is the type of the variable argument list, "...", in the example below?? Thanks //// int my_printf(char* pfmt,...) { // misc code here printf(pfmt,...); } ////
This is standard ANSI 'C' Check it out in your favourite ANSI 'C' textbook - K&R or whatever.
Check the example of vprintf() usage in the library documentation. It shows how to set up for handling variable arguments using the va_' macros and passing the format string and variable argument list to vprintf(). --Dan Henry
See: http://www.eskimo.com/~scs/C-faq/q15.4.html - Mark