c++ - 如何在主执行之外运行 C++ 可执行文件

标签 c++ c

我有一个名为“starTracking”的已编译可执行文件,我需要使用另一个 C++ 程序来运行该文件。 现在我正在使用:

system("./starTracking");

但是我等不及再次调用它之前完成,所以我希望它与我的主程序分开运行,这样我就可以多次调用它而不让我的主程序等待。 有人可以告诉我是否有办法做到这一点? 我将非常感激:D

最佳答案

I need to use another c++ program to run this file

如果在 Windows 上运行 C++,请阅读本指南 Creating Processes

I can't wait it to finish before calling it again, so I'd like it to run apart from my main program so I can call it several times without making my main program wait.

这就是运行进程的作用。要向外部程序发送/接收数据,请确保涉及 stdinstdout。请参阅指南的这一部分: Creating a Child Process with Redirected Input and Output

关于c++ - 如何在主执行之外运行 C++ 可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39009001/

相关文章:

c++ - 是否可以防止信号凝聚?

c++ - 删除导致访问冲突的 std::list

c++ - 语法错误 : Call Member Function Pointer using Pointer to Object

c++ - 添加到 vector 后在析构函数内部双重释放

c - 整数/结构数组结束?

c - 在C中简单使用双数的printf和scanf的问题

您可以根据 for 循环中第一个变量的更改来更新第二个变量吗?

c++ - GCC 问题 : in template

c - 在c中打印二维数组的段错误

c - 使用循环 fork 不同数量的 child