Running an application from within an application

Hello everyone!

I want to execute the following sequence of statements:

1
2
3
4
5
6
7
8
int main() 
{
// do some work x
// call external.exe with data x
// read output produced by external.exe

return 0;
}


I have two main problems:
(1) It is said that system() is not safe, is there an alternative to run an application from within an application?
(2) The external writes output to a file, I want main() to read this output once external finishes execution. Any ides on how to accompish that?
Last edited on
On Windows, the system call is CreateProcess. The shell provides ShellExecute.

You can use either for a user app as a user environment will have the shell.
Topic archived. No new replies allowed.