title: How to mix std::string with Win32 functions that take char[] buffers?
body: <p>There are a number of Win32 functions that take the address of a buffer, such as <code>TCHAR[256]</code>, and write some data to that buffer. It may be less than the size of the buffer or it may be the entire buffer.</p>
  
  <p>Often you'll call this in a loop, for example to read data off a stream or pipe. In the end I would like to efficiently return a string that has the complete data from all the iterated calls to retrieve this data. I had been thinking to use <code>std::string</code> since it's += is optimized in a similar way to Java or C#'s <code>StringBuffer.append()</code>/<code>StringBuilder.Append()</code> methods, favoring speed instead of memory.</p>
  
  <p>But I'm not sure how best to co-mingle the <code>std::string</code> with Win32 functions, since these functions take the <code>char[]</code> to begin with. Any suggestions?</p>