I am making a simple game using c programming for our project. The information of players (Player number such as 1 2 or 3, Name of player, and score) is stored in a text file through structures. I want to "load" the information of the previous players before the game starts so the current player knows what his/her player number is by getting the player numbes from the file and immediately printing it out. I am using the while(!feof(fp))
but I'm getting trouble because it only prints the first player number. Please help me.
while(!feof(fp)) {
fp = fopen("scores.txt","a+");
fscanf(fp, "%i \n", &p[load].nth);
printf ("Loading player no. %i...\n", p[load].nth);
fscanf(fp, "%s \n", p[load].name);
fscanf(fp, "%i \n", &p[load].score);
load++;
}
count=load;
p[count].nth=count;
printf("You are player no. %i", p[count].nth);