title: how to insert multiple characters in a string in C
body: <p>I wish to insert some characters into a string in C:</p>
  
  <p>Example: <code>char string[100] = "20120910T090000";</code></p>
  
  <p>I want to make it something like <code>"2012-09-10-T-0900-00"</code></p>
  
  <p>My code so far:</p>
  
  <pre><code>void append(char subject[],char insert[], int pos) {
      char buf[100]; 
  
      strncpy(buf, subject, pos); 
  
      int len = strlen(buf);
  
      strcpy(buf+len, insert); 
  
      len += strlen(insert);  
  
      strcpy(buf+len, subject+pos); 
      strcpy(subject, buf);   
  }
  </code></pre>
  
  <p>When I call this the first time I get: <code>2012-0910T090000</code></p>
  
  <p>However when I call it a second time I get: <code>2012-0910T090000-10T090000</code></p>
  
  <p>Any help is appreciated</p>