1 #include<stdlib.h>
2 #include<stdio.h>
3 int main()
4 {
5 //cmd为可执行文件绝对路径
6 char *cmd="C:\\Users\\Red\\Desktop\\GVimPortable\\GVimPortable.exe";
7 system(cmd);
8 getchar();
9 return 0;
10 }
本文介绍了一个简单的C语言程序示例,该程序通过system函数调用了位于指定路径下的可执行文件。此方法常用于从C程序中启动其他应用程序。
1 #include<stdlib.h>
2 #include<stdio.h>
3 int main()
4 {
5 //cmd为可执行文件绝对路径
6 char *cmd="C:\\Users\\Red\\Desktop\\GVimPortable\\GVimPortable.exe";
7 system(cmd);
8 getchar();
9 return 0;
10 }