Skip to content

Commit ffeea67

Browse files
author
Mayuri
authored
Update r.c
1 parent facd5c8 commit ffeea67

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • c/fileio/src

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)