Click to See Complete Forum and Search --> : How to call another program?


C++N00bie
March 12th, 2008, 07:30 PM
Hi, I'm working on a program that can execute another program. I'm doing so because I need to run 2 different loops at once, and I don't know how to do that in one program. So my question is, how do I call to another program within my original program?
I'm aware of the std:system("filename") function. But when I call this function, the original program pauses and wait until the called program terminates. I need a function that can execute another program while the original still runs.
Thanks! :)

golanshahar
March 13th, 2008, 06:05 PM
Look at this FAQ : How can I start a process? (http://www.codeguru.com/forum/showthread.php?t=302501)

Cheers

Boris K K
March 14th, 2008, 06:11 AM
For the described problem

Threads (http://www.codeguru.com/forum/showthread.php?t=350759#sdk_thread)

seem more appropriate.

golanshahar
March 14th, 2008, 05:31 PM
For the described problem

Threads (http://www.codeguru.com/forum/showthread.php?t=350759#sdk_thread)

seem more appropriate.


Why using threads? if he will use ::CreateProcess() his original program will continue to run after the call to ::CreateProcess() without waiting for the external program to finish.....

Or maybe I misunderstood the question.. :confused:

Cheers

Boris K K
March 17th, 2008, 05:32 AM
I believe this is the true problem that needs solving:

I'm doing so because I need to run 2 different loops at once, and I don't know how to do that in one program.

and in Windows environment threads are better solution to it than processes. *NIX is another matter...