views:

100

answers:

3

Is it possible to replace printf with userdefined function or is it possible to create function similar like printf

+1  A: 

Sure, you can define variadic functions (the technical name for functions with a variable number of arguments, like printf) -- the URL I've pointed to is one reference for how to do it.

Alex Martelli
A: 

Go look at the source for printf, or _VFPRINTF_R in this case, and see if that is something you want to write.

drawnonward
A: 

If you want to use your own version of printf, you can do something like this once it is defined

/*
 * Make printfs use your new printf
 */
#define printf my_printf

and define your my_printf however you like

As for how printf could be written, have a look at The C Programming Language by K&R. It has a section on how printf function might be written.

hhafez