开发者

run a command in C++ program using "system" API

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开发者_StackOverflow中文版" 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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜