Are you using a text file to store variable data in an attempt to create a "save game" file?
And now you want to pull that data back out from the text file to create a "load game" feature.
Try something like this...
1 2 3 4 5 6 7 8 9 10 11 12
string line; //create a string variable called line.
int myNumber; //create an int variable
ifstream gamefile;
gamefile.open ("xlocation.txt");
if(gamefile.is_open()) {
getline(gamefile, line);
stringstream myStream(line);
myStream >> myNumber;
}
gamefile.close();
cout << myNumber; // to see if it worked
remember to include all needed library files like <string> for example.