I'm trying to write a code where I call a number of programs, with each program's output being the input for the next program.
WinExec(run11, SW_SHOWNORMAL); //to execute program1 WinExec (replace2, SW_SHOWNORMAL); //to execute program2
Now the problem is, program2 starts running before program1 finishes, and therefore the input for program2 still isn't available. The obvious solution is to insert a delay, but program1 could take anywhere between 5 seconds and an hour to finish running. So is there a way to detect when the first program finishes running?