程序代码:
#include<stdio.h> #include<stdlib.h> int main(void) { FILE *fp; int ch; long count=0; char name[41]; printf("输入文件的名称:"); scanf("%s",name); if((fp=fopen(name,"r"))==NULL) { printf("不能打开%s\n",name); exit(1); } while((ch=getc(fp)!=EOF)) { putc(ch,stdout); count++; } fclose(fp); printf("\n文件 %s has %ld 字符\n",name); return 0; }
为什么我输入文件名老提示上面的无法打开额!