简体   繁体   English

是否可以使用C ++执行另一个程序?

[英]Is it possible to execute another program using C++?

What I'd like to do is have my C++ code open up Mplus (statistical program that I've downloaded on my computer) and run it. 我想做的是让我的C ++代码打开Mplus(我已经下载到计算机上的统计程序)并运行它。 Is it possible? 可能吗?

You may be able to do what you want with std::system() calls like: 您可以通过std :: system()调用来完成所需的操作,例如:

std::system("program -e input_commands.txt"); // Assuming it accepts some sort of command line args
std::system("program < input_commands.txt"); // Assuming it responds to stdin

It depends on the program if this approach will work. 这种方法是否有效取决于程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM