title: Writing to a file and console in C
body: <p>I am trying to write a function that allows me to write to the console and a file in C.</p>
  
  <p>I have the following code but i realized that it does not allow me to append arguments (like printf).</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int footprint (FILE *outfile, char inarray[]) {
      printf("%s", inarray[]);
      fprintf(outfile, "%s", inarray[]);
  }
  
  int main (int argc, char *argv[]) {
  
      FILE *outfile;
      char *mode = "a+";
      char outputFilename[] = "/tmp/footprint.log";
      outfile = fopen(outputFilename, mode);
  
      char bigfoot[] = "It Smells!\n";
      int howbad = 10;
  
      footprint(outfile, "\n--------\n");
  
      /* then i realized that i can't send the arguments to fn:footprints */
      footprint(outfile, "%s %i",bigfoot, howbad); /* error here! I can't send bigfoot and howbad*/
  
      return 0;
  }
  </code></pre>
  
  <p>I'm stuck here. Any tips? For the arguments which I want to sent to function:footprints, it will consist of strings, chars and integers.</p>
  
  <p>Are there other printf or fprintf fns that I can try to create a wrapper around?</p>
  
  <p>Thanks and hope to hear ya'll responses.</p>