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,...);
}
////
Read-Only
Author Andrew Neil
Posted 27-May-2001 23:11 GMT
Toolset None
RE: duplicating printf()
Andrew Neil
This is standard ANSI 'C'
Check it out in your favourite ANSI 'C' textbook - K&R or whatever.
Read-Only
Author Dan Henry
Posted 28-May-2001 13:47 GMT
Toolset None
RE: duplicating printf()
Dan Henry
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().
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.