[英]How to execute system command in parallel in c++
通常,当我想从C ++代码运行可执行文件时。 我只是使用代码:
system("path\to\the\executable param");
现在,我想并行运行可执行文件。 我使用2个线程。 第一个线程将调用:
system("path\to\the\executable param1");
第二个线程将调用:
system("path\to\the\executable param2");
但是,它并没有按照我的预期并行运行。
有办法解决这个问题吗?
您可以运行以下多个命令:
system("path\\to\\the\\executable param1 &");
system("path\\to\\the\\executable param2");
这样,两者将并行运行,并且您的程序不需要为此是多线程的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.