1

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.

2 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

Consider popen if you don't want it to block
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.