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.
Here are a couple that may help you:
Running the exe and waiting using _spawnlp:
Code:
_spawnlp (_P_WAIT, "config.exe", "config.exe", Argument1 , Argument2, NULL);
Or
Running the exe and waiting using CreateProcess and WaitForSingleObject:
Code:
PROCESS_INFORMATION ProcessInfo;
StartupInfo.cb = sizeof(STARTUPINFO);
if (CreateProcess(NULL, "config.exe", NULL, NULL, FALSE,0, NULL, NULL, &StartupInfo, &ProcessInfo))
{
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
}
else
{
// Do something else...
}
Hope this helps.