我有一个名为“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.
这就是运行进程的作用。要向外部程序发送/接收数据,请确保涉及 stdin 和 stdout。请参阅指南的这一部分: Creating a Child Process with Redirected Input and Output 。
关于c++ - 如何在主执行之外运行 C++ 可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39009001/