title: Pass varargs to printf
body: <p>I'd like to have a helper function <code>log</code> that essentially does the following:</p>
  
  <pre><code>log(file, "array has %d elements\n", 10);
  // writes "2014-02-03 16:33:00 - array has 10 elements" to &amp;file
  </code></pre>
  
  <p>I have the <a href="https://stackoverflow.com/a/3673291/732016">time</a> portion down, and I have the file writing portion down. However, the problem is the method signature itself for <code>log</code> &mdash; what should I put? <a href="https://stackoverflow.com/a/4178966/732016">This</a> says that the <code>printf</code> declaration ends with the <code>...</code> keyword, but how can I use this in my function?</p>
  
  <pre><code>void log(FILE *f, const char * format, ...) // how would I pass ... to fprintf?
  </code></pre>
  
  <hr>
  
  <p>Let me <strong>EDIT</strong> this to include a bit more information.</p>
  
  <p>I have a <code>const char * now ()</code> that returns a string of the form "2014-02-03 16:33:00." I would like to pass another format string in like this. The two statements should be equivalent:</p>
  
  <pre><code>log(file, "array has %d elements\n", 10);
  fprintf(file, "%s - array has %d elements\n", now(), 10);
  </code></pre>
  
  <p>I know that <code>vfprintf</code> allows me to pass a <code>va_list</code>, but how can I put the <code>now()</code> as the first argument, <em>before</em> all the others?</p>