I have a text file named settings.txt
. Inside it i have it saying:
Name = Dave
I then open the file and loop the lines and characters in my script:
std::ifstream file("Settings.txt");
std::string line;
while(std::getline(file, line))
{
for(int i = 0; i < line.length(); i++){
char ch = line[i];
if(!isspace(ch)){ //skip white space
}
}
}
What I am trying to work out is assign each value to some kind of variable which will count as my "global settings" for the game.
So the end result would be something like :
Username = Dave;
But in such a way i can add extra settings at a later date. I can't work out how you would do it =/