Skip to content

Commit b364dd3

Browse files
authored
Update r.c
1 parent 64e1067 commit b364dd3

File tree

1 file changed

+9
-3
lines changed
  • c/fileio/src

1 file changed

+9
-3
lines changed

c/fileio/src/r.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#include "../include/head.h"
22
int r(const char* filename){
33
FILE *fp = fopen("file.txt","r");
4-
char a[100];
5-
fscanf(fp,"%s",a);
6-
printf("%s",a);
4+
int i;
5+
long location=-2;
6+
while(ftell(fp)!=-1 && ftell(fp)!=location){
7+
//location=ftell(fp);
8+
//printf("location:%ld ",location);
9+
char a[100];
10+
fscanf(fp,"%s",a);
11+
printf("%s \n\n",a);
12+
}
713
fclose(fp);
814
return 0;
915
}

0 commit comments

Comments
 (0)