-
Struct, fopen.
okay i have this code.
int round;
char day[3];
char time[5];
char hometeam[3];
char guestteam[3];
inthometeamscore;
int guestteamscore;
int main(void){
FILE *fp;
fp=fopen("results.txt","r");
while(!feof(fp)){
fscanf(fp,"%d %s %s %s - %s %d - %d", &round, day, time, hometeam, guestteam, &hometeamscore, &guestteamscore);
printf("\n%d %s %s %s - %s %d - %d", round, day, time, hometeam, guestteam,
hometeamscore, guestteamscore);
}
}
return 0;
}
I want to take one variable for instance day and put it into an struct containing an array.But i don't know how to use fopen in a struct. But any kind of hints on making this is apreciated :D
-
There's a rash of people not reading the intro threads, and not using code tags.
Read the intro, then edit your post.
-
Using a struct to store your data has nothing to do with fopen.
-