I'm making files to store data for a game I'm making. Theres a box that is going to display all the profiles and you will be able to select one. so how would i check if any files exist when i dont know the name of the file(s)? like there could be like 3 profiles saved and I have to check for those. heres my code so far for making a file if none exists:
You have to decide what a profile file is. If it's name has a certain convetion (like <id>.profile), then you can check if such files exist. You can check a file's info without opening it with stat().
should I have just one file with all the data on it
I'm using windows. I see now that it is os dependent. all I want to do is look in a folder that i already know exists and the location. then look at all the files in that folder to open them for data. It still seems easier just to have one file with a predetermined name and just the player data on each line like this:
john 1 1000
bob 3 1550
and just getline each line until there is a white space then break up the data into variables when the user selects what profile they wish to load. this isn't being done in the console but I got that part covered.