title: C++ Converting Vector<BYTE> to string where first vector byte is 0
body: <p>I am trying to convert a std::vector of BYTES (or unsigned char) to a std::string.
  The problem I have is when the first element of the vector is a 0, then this returns an empty string after the conversion.</p>
  
  <p>I have tried the 2 methods below. Both string1 and string2 return an empty string. 
  The result I am expecting is a string that starts with 2 x 0s followed by several other characters.</p>
  
  <pre><code>// vector of BYTE, contains these 7 elements for example: (0,30,85,160,155,93,0)
  std::vector&lt;BYTE&gt; data;
  
  // method 1
  BYTE* pByteArray = &amp;data[0];
  std::string string1 = reinterpret_cast&lt;LPCSTR&gt;(pByteArray);
  
  // method 2
  std::string string2(data.begin(),data.end());
  
  // both string1 and string2 return ""
  </code></pre>
  
  <p>I am guessing because the first BYTE in the vector is a 0, so the string assignment is thinking it's null or empty.
  Is there some other conversion I can do in order to return the rest of the string?</p>
  
  <p>Any help greatly appreciated.</p>