Keil Logo Arm Logo

Discussion Forum

duplicating printf()

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
andy corkan
Posted
27-May-2001 17:03 GMT
Toolset
None
New! duplicating printf()
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
New! RE: duplicating printf()
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
New! RE: duplicating printf()
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
Read-Only
Author
Mark Odell
Posted
28-May-2001 14:05 GMT
Toolset
None
New! RE: duplicating printf()
See:

http://www.eskimo.com/~scs/C-faq/q15.4.html

- Mark

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.