大家好,请看看这个程序有哪些错误啊?
#include <stdio.h>
void main()
{
FILE *fp,ch;
char filename[10];
printf("Please input the name of file: ");
scanf("%s", filename);
if((fp=fopen(filename, "r")) == NULL)
{
printf("Cannot open the file.\n");
exit(0);
}
else
{
ch=fgetc(fp);
while(ch!=EOF)
{
putchar(ch);
ch=fgetc(fp);
}
}
fclose(fp);
}
文件打开问题