【发布时间】:2012-06-09 02:18:39
【问题描述】:
我有以下简单的程序。我正在从命令行运行“程序 file.txt”并得到“总线错误”而没有输出。我不知道我在这里做错了什么。
#include<stdio.h>
int main(char *arg[])
{
FILE *file = fopen(arg[0], "r");
if (file == NULL) {
printf("Cannot open file.\n");
exit(1);
}
return 1;
}
【问题讨论】: