如何用c语言打开电脑上安装的程序?

2025-03-09 22:29:00
推荐回答(4个)
回答1:

/*1*/
#include
#define PATH_L 100
int main(void)
{
char path[PATH_L] = "";
fgets(path, PATH_L, stdin);
//假设你输入的路径为C:\windows\system32\mspaint.exe
//这个是系统自带的画图程序

system(path);
return 0;
}

/*2*/

//你可以使用system函数调用start命令完成打开文件夹的任务
#include
#include
#define PATH_L 100

int main(void)
{
char path[PATH_L] = "";
char cm[PATH_L] = "start ";
fgets(path, PATH_L, stdin);

strcat(cm, path);
system(cm);

return 0;
}

回答2:

运行 (“填写你要打开的程序的路径”, 假, ) ,,,,比如:D:\QQ.exe

回答3:

API:writefile(磁盘i/o);CreateChildProcess(创建子进程)
到msdn搜一下,分自己留着吧
学过mfc吗?
应该有

回答4:

蛮简单的,不过需要去找下相应的API,也就是自带的函数,调用它就可以了,不需要自己编写。