: "C:\\Program Files\\Diablo II\\game.exe" -did not work
: "C:\\\"Program Files\"\\\"Diablo II\"\\game.exe" -worked
You need something like this: The outmost quotes are for the C compiler and are not passed to the system() function.
system("\"D:\\Program Files\\Diablo II\\game.exe\"");
: What is up with all the slashes and quotes. What are they doing?
you need double quote when you wnat a literal slash in the string. Otherwise the C compiler will attempt to interpret the next character as an escape character, such as '\n', '\r', '\t' and others.
: stober, do I need a certain header for win32 api function CreateProcess()?
: stober, I load up 40 instances of d2 using d2loader on 3 comps and play them in window mode with the -w command after the target in the shortcut properties.
The below worked on my computer, where I installed Diablo on drive D:
sinfo.cb = sizeof(STARTUPINFO);
if( CreateProcess(0,"\"D:\\Program Files\\Diablo II\\game.exe\"", 0,0,0,0,0,0,&sinfo,&pinfo)== 0)
printf("Create Process failed\n");