Here are a couple that may help you:
I want the code to run an exe file basically.
i also want to make sure that config.exe finsihes (ie exits) then the code runs the main program.
Running the exe and waiting using _spawnlp:
_spawnlp (_P_WAIT, "config.exe", "config.exe", Argument1 , Argument2, NULL);
Running the exe and waiting using CreateProcess and WaitForSingleObject:
Hope this helps.
StartupInfo.cb = sizeof(STARTUPINFO);
if (CreateProcess(NULL, "config.exe", NULL, NULL, FALSE,0, NULL, NULL, &StartupInfo, &ProcessInfo))
// Do something else...