title: Converting std::strings to WCHAR* and char*
body: <p>I am trying to create a resource manager that tells you where a file is based on a key word. I am trying to implement it into my Directx11 programming code, but I've run into some problems. The code calls for <code>WCHAR*</code> and <code>char*</code> file paths. I have the file path written in an std::string format.</p>
  
  <pre><code>char* ResourceManager::getFilePathCHAR(string reference){
      string location;
      //looks through a file and gives the folder
      location = parser(reference);
      string result;
      //adds the other stuff like c:// ........../image.png
      result = appender(location, reference);
      m_filePathChar = new char[result.length() + 1]; ////--|
      strcpy(m_filePathChar, result.c_str());         ////--|-&gt; part im looking at
      return m_filePathChar;                          ////--|
  }
  </code></pre>
  
  <p>The problem with this is that the other information ive been reading on have told me that return pointers like this is bad, so i just want to know if theres a better way to do this? Also, how do i convert <code>std::string</code> to <code>WCHAR*</code>. I am probably not looking hard enough but the majority of places I've checked have given me infromation on <code>wchar_t</code>. I am still relatively new to pointers, so im not sure about the exact rules on what you can and can't do. Thanks for the help and input.</p>