hiho@ll
is it possible to write a wrapper for printf
what i want:
myprintf("%s%d","test",5);
void myprintf(char *fmt,...){
var_list ap;
va_start(ap,fmt);
openlogfile();
printf("HMM ");
printf(fmt,ap); // << doesn't work, but how can i do this?
closelogfile();
}
in the above example (well, i tried without openlogfile, etc.) i got HM-1073745612
1. can it work?
2. how?
3. the next step i'm thinking about is a function, which calls another function depending on the argument
this means i want to write a wrapper for every possible function
this includes that one argument of my wrapper function is a function pointer!
void* mywrapper(void* (*func)(void*,...),...);
is this possible and how?
why i want to do this?
1. i'm interested if it works
2. maybe i can do some cool log functions
3. or my own memory management class (maybe )
thx@ll