title: use printf("text %d", number) type format to assign value to variable
body: <p>I would like to use the syntax that printf uses, using the %d, %s and adding values after to assign a value to a char[]. Is this possible?</p>
  
  <p>e.g. Given an output of:</p>
  
  <pre><code>printf("now: %d-%d-%d %d:%d:%d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
  </code></pre>
  
  <p>I'd like to assign that to char[] output;</p>
  
  <p>How can this be done?</p>
  
  <p>I tried: </p>
  
  <pre><code>sprintf(output, "now: %d-%d-%d %d:%d:%d\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
  </code></pre>
  
  <p>but that didn't seem to work. Is sprintf used differently... or is that not what I should be using?</p>
  
  <p>Thanks!</p>
  
  <p>EDIT: It turned out I simply needed to increase the initialized length of output...</p>