title: Converting string to LPWSTR
body: <p>I'm having a hard time converting a string into <code>LPWSTR</code> so I can use the <code>PathStripToRoot()</code> function. </p>
  
  <p>Well for one the MSDN documation says I need <code>LPTSTR</code> variable (<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb773757%28v=vs.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/bb773757(v=vs.85).aspx</a>), but Visual Studio 2013 says I need <code>LPWSTR</code>. </p>
  
  <p>Here is a code snippet of my function:</p>
  
  <pre><code>fileStat fileCreate(const string&amp; targetFile)
  {
      fileStat filez;
  
      fstream file(targetFile.c_str());
      if (!file)
      {
          cout &lt;&lt; "File does not exist" &lt;&lt; endl;
      }
  
      std::ifstream in(targetFile, ios::binary | ios::ate);
      int a = in.tellg();
      cout &lt;&lt; "File size(bytes): " &lt;&lt; in.tellg() &lt;&lt; endl &lt;&lt; endl;
      file.close();
  
  
      wstring stemp = strChange(targetFile);
      LPCWSTR result = stemp.c_str();
  
      /* Tried the below code but that did not work
      LPWSTR ws = new wchar_t[targetFile.size() + 1]; 
      copy(targetFile.begin(), targetFile.end(), ws);
      ws[targetFile.size()] = 0;
          */
  
      cout&lt;&lt;"\n\n"&lt;&lt;PathStripToRoot(ws)&lt;&lt;"\n\n";
  
   ...
      filez.fileSize = a;
      return filez;
  }
  </code></pre>
  
  <p>A lot of people have said to use <code>MultiByteToWideChar()</code> function but I looked at the MSDN documation and have no idea how it works. Is there an easier way than using <code>MultiByteToWideChar()</code> ?</p>