我是这个论坛的新手.我需要一个在Windows中运行exe文件的程序.谷歌搜索我发现下面的代码:
1.代码:
#include<stdlib.h>
#include<stdio.h>
int main()
{
(void)system("C:\\Windows\\notepad.exe");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
上面的代码在Borland Turbo C中成功编译.但它无法运行记事本.
2代码:
#include<stdlib.h>
#include<stdio.h>
void main()
{
int result ;
result=system("C:\\Windows\\notepad.exe");
printf("%d",result);
}
Run Code Online (Sandbox Code Playgroud)
上面的运行代码给出-1作为输出.为什么我得到-1.
我的操作系统Windows XP Borland Turbo C编译器
请帮忙.
c ×1