title: C++ std::string problem using VC10
body: <p>I'm using C++, Visual Studio 2010 Premium on Windows 7, and in my application I have a std::string variable that fails on append :( ... </p>
  
  <p>The situation is, the string variable contains a huge amount of chars appended at different times, first time I add for example 7609 bytes, second time 8184 and finally 1463, something like</p>
  
  <pre><code>std::string str; 
  long bytesRead; 
  char buffer[BUFFER_SIZE];
  
  do { 
     bytesRead = ReadChars(buffer, BUFFER_SIZE -1); 
     buffer[bytesRead] = 0; // I omitted this line before, but it was in the original code
     if (bytesRead &gt; 0)    
         str += buffer; // I'm already taking care of the char 0 at the end :)
  } while (bytesRead &gt; 0); 
  </code></pre>
  
  <p>so every time I call += (or append, same result) it append an extra string (last 7 or 8 chars from original buffer) for instance</p>
  
  <p>original buffer ends
  <strong>"string appended"</strong></p>
  
  <p>after append, str ends
  <strong>"string appendedappended"</strong></p>
  
  <p>does anyone knows if this is a known issue? or maybe if I missed something</p>
  
  <p>I put this into the comments down there, but maybe better if I put it here too</p>
  
  <p><strong>ReadChars</strong>: read a bounch of chars and return the number of bytes read</p>
  
  <p><strong>bytesRead</strong>: if read, it is > 0... so is ok to treat buffer as ASCIIZ, </p>
  
  <p>I tried with append function but obtain same behavior ( like this str.append(buffer); )</p>
  
  <p>Regards
  Jorge</p>