- Joined
- Jul 23, 2007
- Sythe Gold
- 0
- Messages
- 1,188
Code:
string name;
int menuChoice, attackMenu, shopMenu, saveLoad;
int level = 1, counter;
int exp = 0, expGain = 25;
int gold = 0;
int health = 100;
int enemyHealth = 100;
int damage, enemyDamage;
char again;
ofstream Name, Level, Exp, Gold, COUNTER;
ifstream NAME, LEVEL, EXP, GOLD, Counter;
Counter.open("counter.txt",ios::in);
{
if(Counter)
{
Counter >> counter;
}
}
Counter.close();
cout << "Press 1 to load previous save\nPress 2 to start new game\n";
cin >> saveLoad;
switch(saveLoad)
{
case 1:
if(counter == 1)
{
NAME.open("name.txt",ios::in);
{
if(NAME)
{
system("cls");
getline(NAME,name);
}
else
{
cout << "ERROR";
system("PAUSE");
system("cls");
return EXIT_SUCCESS;
}
}
Please explain why the name from the file will not be assigned to name.
EDIT:: This is just partial code. All the rest works perfect. I just can not get the name to be assigned to the variable.
EDIT:: BUMP! Please help me out here guys.


