title: how to get append mode in sprintf()
body: <p>See this code:</p>
  
  <pre><code>int main() {
      char a[50];
      FILE *fp;
  
      fp = fopen("test1.txt", "w");
  
      sprintf(a,"jigar %d \n", 3);
      fprintf(fp,"jigar %d \n", 3);
  
      sprintf(a,"patel %d \n", 2);
      fprintf(fp,"patel %d \n", 2);
      printf("%s", a);
  }
  </code></pre>
  
  <p>Here, using <code>fprintf</code>, I can write in file </p>
  
  <pre><code>jigar 3 
  patel 2 
  </code></pre>
  
  <p>where same functionality I want where what ever I print that goes in one char buffer. </p>
  
  <p>but using <code>sprintf</code> gives me on buffer</p>
  
  <pre><code>patel 2 
  </code></pre>
  
  <p>I have so many such print which I want to add in one char buffer and then I need to return it to application so how to get it in <strong>simplest and fastest</strong> way this?</p>