title: CreateProcess execute EXE
body: <p>I have an application where the user uploads a file to the remote server, the same server to receive this file should run this application. I'm using the CreateProcess method. The problem is, the file directory is already defined in a std :: string, and I'm having difficulties to pass this directory as a parameter to the CreateProcess.</p>
  
  <p>How do I that this directory can be passed to the CreateProcess without errors?</p>
  
  <pre><code>    //the client remotely sends the directory where the file will be saved
      socket_setup.SEND_BUFFER("\nRemote directory for upload: ");
      char *dirUP_REMOTE = socket_setup.READ_BUFFER();
      std::string DIRETORIO_UP = dirUP_REMOTE; // variable where it stores the remote directory
  
  
          //after uploading this is validation for executing file
  if (!strcmp(STRCMP_EXECUTE, EXECUTE_TIME_YES))
  {
      STARTUPINFO si;
      PROCESS_INFORMATION pi;
      ZeroMemory( &amp;si, sizeof(si) );
      si.cb = sizeof(si);
      ZeroMemory( &amp;pi, sizeof(pi) );
  
      std::wstring wdirectory;
      int slength = (int)directory.length() + 1;
      int len = MultiByteToWideChar(CP_ACP, 0, directory.c_str(), slength, 0, 0);
      wdirectory.resize(len);
      MultiByteToWideChar(CP_ACP, 0, directory.c_str(), slength, &amp;wdirectory[0], len);
      if (!CreateProcess(NULL, wdirectory.c_str(), NULL, NULL, FALSE, 0, NULL, NULL, &amp;si, &amp;pi));
  }
  </code></pre>