title: How do I convert from a wchar_t* to a wstring?
body: <p>Or how to I initialize a wstring using a wchar_t*?</p>
  
  <p>I tried something like this, but it's not quite working.
  I'm given an LPVOID and it points to a wchar_t pointer.
  I just want to get it into a wstring so I can use some normal string functions on it.</p>
  
  <pre><code>LPVOID lpOutBuffer = NULL;
  //later in code this is initialized this way
  lpOutBuffer = new WCHAR[dwSize/sizeof(WCHAR)];
  //fills up the buffer
  doStuff(lpOutBuffer, &amp;dwSize);
  //try to convert it to a wstring
  wchar_t* t =  (wchar_t*)lpOutBuffer;
  wstring responseHeaders = wstring(t);
  
  printf("This prints response headers: \n%S", t);
  printf("This prints nothing: \n%S", responseHeaders);
  </code></pre>
  
  <p>doStuff is really a call to <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa384102%28v=vs.85%29.aspx" rel="nofollow">WinHttpQueryHeaders</a>
  I just changed it to make it easier to understand my example.</p>