title: Appending to char array with sprintf
body: <p>So it is tempting to do this:</p>
  
  <pre><code>char buf[1024] = "this is";
  std::sprintf(buf, "%s test", buf);
  </code></pre>
  
  <p>But it is undefined behaviour. I suppose it can be solved via temporary:</p>
  
  <pre><code>char buf[1024] = "this is";
  std::sprintf(buf, "%s test", std::string(buf).c_str());
  </code></pre>
  
  <p>What are the downsides of this approach?</p>