title: Replacing backslash with double backslash or forward slash in LPSTR filepath
body: <p>I am trying to post a message to the WIN32 API to open a WAV File. I can do this by setting the LPARAM parameter to L"C:/path/file.wav" This works excelent! However, I have been trying to use a dialogbox to generate a string to a filepath. The OpenFileDialog function can return the selected filepath as a LPSTR datatype, which sounds perfect! However, this filepath is recognized as a windows filepath, thereby consisting of backslashes. Since these backslashes are not escaped or replaced for a forward slash, the compiler starts crying due to an incorrect formed universal character name. Therfore, it seems trivial to replace all the \ in the LPSTR filepath for \ or /. I have been trying to do this in several ways but nothing seems to work.</p>
  
  <pre><code>wchar_t* SelectAudioFile(HWND windowHandle) {
      OPENFILENAME ofn;      // common dialog box structure
      char szFile[260];      // buffer for file name
  
      // Initialize OPENFILENAME
      ZeroMemory(&amp;ofn, sizeof(ofn));
      ofn.lStructSize = sizeof(ofn);
      ofn.hwndOwner = windowHandle;
      ofn.lpstrFile = (LPWSTR)szFile;
  
      ofn.lpstrFile[0] = '\0';
      ofn.nMaxFile = sizeof(szFile);
  
      ofn.lpstrFilter = L"Waveform Audio File Format (*.wav)\0*.wav\0";
  
      ofn.nFilterIndex = 1;
      ofn.lpstrFileTitle = NULL;
      ofn.nMaxFileTitle = 0;
      ofn.lpstrInitialDir = NULL;
      ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
  
      // Display the Open dialog box.
  
      if (GetOpenFileName(&amp;ofn)==TRUE) {
          CreateFile(ofn.lpstrFile,
              GENERIC_READ,
              0,
              (LPSECURITY_ATTRIBUTES) NULL,
              OPEN_EXISTING,
              FILE_ATTRIBUTE_NORMAL,
              (HANDLE) NULL);
          MessageBox(windowHandle,ofn.lpstrFile,0,0);
      }
  
       //Here the backslash should be escaped or replaced.
  
      const wchar_t * currentPath = ofn.lpstrFile; //This is a LPSTR 
      wchar_t * newPath;
      int filePathLength = sizeof(currentPath);
  
      for (int i=0; i &lt; filePathLength; i++) {
          if (currentPath[i] == "\\") {
              newPath[i] = "\\\\";
          } else {
              newPath[i] = filePath[i];
          }
      }
      return newPath;
  
  
  }
  </code></pre>
  
  <p>The following line would post a message telling it to open a certain file at a path</p>
  
  <pre><code>PostMessageW(hwnd, WMA_OPEN, 0, (LPARAM)SelectAudioFile(hwnd)); 
  </code></pre>
  
  <p>Thus replacing the LPARAM with a static filepath works!</p>
  
  <p>How should I replace the backslashes in the filepath?</p>
  
  <p>Thanks a million times!</p>