【发布时间】:2013-07-17 15:17:23
【问题描述】:
我希望我的 C++ 程序在 Windows 中执行另一个 .exe。我该怎么做?我正在使用 Visual C++ 2010。
这是我的代码
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
unsigned int input;
cout << "Enter 1 to execute program." << endl;
cin >> input;
if(input == 1) /*execute program here*/;
return 0;
}
【问题讨论】:
-
您可以使用stackoverflow.com/questions/478898/… 调用您的任何可执行文件。
-
您可以为此使用ShellExecute。
-
这工作:
system("programtoexecutenamehere") -
你可以使用谷歌搜索!