#include <stdio.h>
#define SIZE
20
struct information
{
int number;
char fname[SIZE];
char lname[SIZE];
int play_count;
int hit_count;
int go_count;
int rbi;
}num[19];
int _read(FILE *fp, int i)
{
return (fscanf(fp, "%d%s%s%d%d%d%d",
&num[i].number,num[i].fname,num[i].lname,&num[i].play_count,
&num[i].hit_count,&num[i].go_count,&num[i].rbi)==7);
}
main()
{
FILE *fp = fopen("test.txt", "r");
int i;
for (i=0; _read(fp,i)&&i<19; ++i)
printf("%d %s %s %d %d %d %d\n",
num[i].number,num[i].fname,num[i].lname,num[i].play_count,
num[i].hit_count,num[i].go_count,num[i].rbi);
fclose(fp);
}
/* test.txt
4 Jessie Joybat 5 5 3 3
18 Mngssie Moybat 5 2 2 1
10 Jghsie Jybat 5 5 1 2
14 Aebvie Aoybat 7 2 8 1
13 Nessie Noybat 9 3 1
*/