鄙视下LZ,会你不会的就可以做你的老师了
有了目标才有动力!!!
#include<stdio.h> #include<stdlib.h> main() { FILE *fp; char str[256]; if((fp=fopen("F:\\filename.text","r"))==NULL) // 注意那个反斜线 { fprintf(stderr,"error open of file"); exit(1); } while(!feof(fp)) { fscanf(fp,"%s",str); puts(str); printf("%ld\n",ftell(fp)); } rewind(fp); printf("%ld\n",ftell(fp)); fclose(fp); return 0; }