I have a terrible problem with my code. I am saving some data by:
void savetofile()
{
fprintf(savefile, "%d\n", run); // here are 1 or 2 characters
fprintf(savefile, "%d\n", gender); // 1 character
fprintf(savefile, "%s\n", name); // here is string, max 20 characters
fprintf(savefile, "%d\n", points1); // between 1 and 3 characters
fprintf(savefile, "%d\n", points2); // between 1 and 3 characters
}
How can I read them after saving? Can I somehow specific line with:
fscanf(savefile, "%d", &gender);
to read specificaly line 2?
Maybe when I save data to file as that:
void savetofile()
{
fprintf(savefile, "%d ", run); // here are 1 or 2 characters
fprintf(savefile, "%d ", gender); // 1 character
fprintf(savefile, "%s ", name); // here is string, max 20 characters
fprintf(savefile, "%d ", points1); // between 1 and 3 characters
fprintf(savefile, "%d ", points2); // between 1 and 3 characters
}
It will be easier to read?