< 1> < 2> < 3> < 4> < 5> < 6> < 7> < 8> < 9> < 10> < 11> < 12> < 13> | int main(void){ FILE *fp; int n; fp=fopen("085sample.txt","r"); while((n=fgetc(fp))!=EOF){ printf("%c",n); } fclose(fp); getchar(); return 0; } |
< 1> < 2> < 3> < 4> < 5> < 6> < 7> < 8> < 9> < 10> < 11> < 12> < 13> | int main(void){ FILE *fp; char buf[1024]=""; fp=fopen("085sample2.txt","r"); while(fgets(buf,1023,fp)!=NULL){ puts(buf); } fclose(fp); getchar(); return 0; } |
< 1> < 2> < 3> < 4> < 5> < 6> < 7> < 8> < 9> < 10> < 11> < 12> < 13> | int main(void){ FILE *fp; char buf[1024]=""; fp=fopen("085sample2.txt","r");//(1) while(fgets(buf,1023,fp)!=NULL){//(2) printf("%s",buf);//(3) } fclose(fp); getchar(); return 0; } |