tags:

views:

85

answers:

2

I want to run a DOS command in my C++ program. The point is that I want my program stops while the DOS command is executed. I have used "System" API. My question is "Does 'system' make a new thread/process to run the DOS command in it or it just stops the program until the command is done?" If it creates a new process, how can I stop the program while 'system' is running?

Thank you so much, Shadi.

+3  A: 

It creates a new process and waits for it to exit.
http://www.cplusplus.com/reference/clibrary/cstdlib/system/

Kyle Alons
Consider popen if you don't want it to block
frankc
A: 

Kyle is right, it creates the new process and waits for it to exit. The link he gave is also a very good reference for all things C++.

If you want to stop the program while the "system" call is running, just do a Ctrl-C in your DOS terminal and the program will exit.

royerboat