title: std::string to BYTE[]
body: <p>My goal is to get this:</p>
  
  <pre><code>BYTE       Data1[]     = {0x6b,0x65,0x79};
  BYTE       Data2[]     = {0x6D,0x65,0x73,0x73,0x61,0x67,0x65};
  </code></pre>
  
  <p>But my starting point is:</p>
  
  <pre><code>std::string msg = "message";
  std::string key = "key";
  </code></pre>
  
  <p>I am not able to get from <code>std::string</code> to <code>BYTE[]</code>.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>std::vector&lt;BYTE&gt; msgbytebuffer(msg.begin(), msg.end());
  BYTE*       Data1     = &amp;msgbytebuffer[0];
  </code></pre>
  
  <p>This didn't cause compile or run time error. However, the end result (I feed this to a winapi function - crypto api) was not the same as when I used the actual byte array like in top most (<code>{0x6D,0x65,0x73,0x73,0x61,0x67,0x65}</code>).</p>