Hello all, my problem is:
I'm making a snake game, currently I'm stuck at highscore saving.
I can write to a file named saves.svg, contents are:
1 2 3
name1 12
name2 10
name3 8
now to read from the file I got this:
1 2 3 4
while(myfile>>hsname[i]>>hs[i]&&i<3)
{
i++;
}
the hsname is a string array, that part reads the names. the hs is a int array and it always remains at 0, aparently it doesn't read the integer from file. Is there another option I could use or am I doing something wrong?
You must show the code, not just describe the code. It may not be your case, but there have been persons saying "I have that part OK, that's why I don't show it" and it turns out that the part they thought was OK was in fact the one with the problem. So if you are asked to show the declarations, you should show them for clarity's sake. :-)
You also failed to answer the question: Do names in the text file have spaces?
Here's the function that uses the reading, gotoxy(); is just the function to move the handle to x and y coordinate.
writescore(); writes it to savegame. That part works(tried it with preset vars).