We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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,...); } ////
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