Passing all multiple arguments for a function in C
"leiboviche" <leiboviche-/[email protected]> Sun, 16 Dec 2007 08:50:58 -0000
| Newsgroups | gmane.culture.hackers.israel |
|---|---|
| Message-ID | <[email protected]> |
I'm facing a situation that probably occurs to writers of most
applications with log file capabilities.
I wish to have a function log() which only redirects it's input to an
already opened file:
int log(char *fmt,...) {
/* I want to call fprintf(logfile,fmt,...);
but it's impossible to push all the multiple arguments
in the stack to the stack again and then call fprintf,
so what I would do if I've used ASM is to push only
logfile to the stack, and then issue a "call _fprintf"
assembly instruction.
Is this possible without using inline assembly?
Can I tell C to just push a single value to the stack
and then call this function?
this is really useful for passing multiple arguments from function
to function.
*/
}