title: How do you write formatted output, as from printf, into a string?
body: <pre><code>const char* strrep(listing list) {
  //https://stackoverflow.com/q/4836534/9295513
  char* retVal = //...
  return retVal;
  }
  </code></pre>
  
  <p>I have a struct type called <code>listing</code>. Is there a way to format elements as if by calling <code>printf</code> with <code>("%d %d %s...", list-&gt;elem_one, list-&gt;elem_two, list-&gt;elem_three...)</code> but write the output to an array of <code>char</code> instead of to standard output?</p>