Subject: Passing all multiple arguments for a function in C

From: "leiboviche" <[email-masked]>
Date: Sun, 16 Dec 2007 08:50:58 -0000

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.
  */
}

---

From: Adam Morrison <[email-masked]>
Date: Sun, 16 Dec 2007 17:28:20 +0200

>   /* I want to call fprintf(logfile,fmt,...);

Check out vfprintf(3).