I have an application, where the user uploads a file to the remote server, this same server when receiving 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 trouble passing this directory as a parameter to CreateProcess.
How do I proceed so that this directory can be passed to the CreateProcess without errors?
EDIT: Now the code compiles, but the file does not execute ...
//o cliente envia remotamente o diretorio onde sera salvo o arquivo
socket_setup.SEND_BUFFER("\nDiretorio remoto para upload: ");
char *dirUP_REMOTE = socket_setup.READ_BUFFER();
std::string DIRETORIO_UP = dirUP_REMOTE; // variavel onde se armazena o diretorio remoto
//depois do upload essa é a validação para execução do arquivo
if (!strcmp(STRCMP_EXECUTE, EXECUTE_TIME_YES))
{
std::wstring temp(directory.begin(), directory.end());
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
CreateProcess(NULL, (LPWSTR)temp.c_str(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
}