title: snprintf for string concatenation
body: <p>I am using snprintf to concatenate a string to a char array:</p>
  
  <pre><code>char buf[20] = "";
  snprintf(buf, sizeof buf, "%s%s", buf, "foo");
  printf("%s\n", buf);
  snprintf(buf, sizeof buf, "%s%s", buf, " bar");
  printf("%s\n", buf);
  </code></pre>
  
  <p>The problem is the second concatenation to <code>buf</code> instead of adding <code>"bar"</code>, replaces <code>"foo"</code> with it. The output is like:</p>
  
  <pre><code>foo
  bar
  </code></pre>
  
  <p>The first <code>%s</code> should keep <code>buf</code> (which in this case holds <code>"foo"</code>) there. And the second <code>%s</code> should attach <code>"bar"</code> to it. Right?</p>
  
  <p>What am I doing wrong?</p>