BUPT-homework/semester2/pset3/3-readFile.c

27 lines
384 B
C
Raw Normal View History

2022-04-03 23:22:03 +08:00
#include <stdio.h>
#include <strings.h>
#include <string.h>
int main(void) {
FILE *fp = fopen("dict.dic", "r");
int a;
char b[16]; // bool
double c;
char d[4096];
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
fscanf(fp, "%i%s%lf%s", &a, b, &c, d);
}
printf("%i\n", a);
printf("%s\n", b);
printf("%lf\n", c);
printf("%s\n", d);
return 0;
}