I am making a program that reads football player stats from a file and places it in an array
how ever my program seems to over read the file which has the stats of 17 players and it makes an array of 101 players with the first 17 being alright and the rest being filled in with spaces and random characters and symbols such as spades
can someone help me fix this
here is the player structure and read data function
typedef struct player
{
int number, atmp, yards, TD;
char fname[30];
char lname[30];
char pos[4];
} playerdata;
/* Begin Read Data function */
void readdata(playerdata player[],
int size)
{
FILE *fptr;
if ((fptr = fopen("C:/Documents and Settings/Owner/Desktop/Jason/C programing/assignment6/assignment6data.txt", "r")) == NULL)
{ printf("Error: the file cannot be opened\n");
}
else
size;
int i;
for (i = 0; i < size; i++)
{
fscanf(fptr, "%s %s %s %s %s %s %s", &player.number, &player.fname,
&player.lname, &player.pos, &player.atmp, &player.yards,
&player.TD);
}
}