title: How do I convert PWSTR to string in C++?
body: <p>I have the following code:</p>
  
  <pre><code>// Fetch Local App Data folder path.
  PWSTR localAppData = (PWSTR) malloc(128);
  SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &amp;localAppData);
  
  // Find out the absolute path to chrome.exe
  stringstream ss;
  ss &lt;&lt; localAppData &lt;&lt; "/Google/Chrome/Application/chrome.exe";
  </code></pre>
  
  <p>The result of stringstreamer's <code>.str()</code> is <code>008F6788/Google/Chrome/Application/chrome.exe</code>, which is wrong.</p>
  
  <p>I can't seem to get stringstreamer to work, neither do strcat or wcsncat due to type incompatibilities.</p>
  
  <p>How do I cast this PWSTR to string?</p>