title: C string append
body: <p>I'm looking for an efficient method for appending multiple strings.<br>
  The way it should work is C++ std::string::append or JAVA StringBuffer.append.  </p>
  
  <p>I wrote a function which actually reallocs previous source pointer and does strcat.  </p>
  
  <p>I believe this is not an efficient method as compiler may implement this free and malloc.  </p>
  
  <p>Other way I could think of (like std::vector) is allocate memory in bulk (1KB for eg) and do strcpy. In that case every append call will check if the total required allocation is more than (1200 bytes) the amount allocated in bulk, realloc to 2KB. But in that case there will be some memory wasted.  </p>
  
  <p>I'm looking for a balance between the above but the preference is performance.  </p>
  
  <p>What other approaches are possible. Please suggest.</p>