Ok, i am trying to make my MUD write the players information to a file, which it does, but when i try to make it check if a file for a player exists before it tries to load it, i cant get it to work... here is the code for saving the player (which works perfectly...)
but while trying to load the character using this code:Code:void saveChar(Stats &S)
{
ofstream fout;
fout.open(S.name.c_str());
fout<<S.name<<endl<<S.race<<endl;
fout<<S.lvlexp<<endl<<S.maxlife<<endl;
fout<<S.defense<<endl<<S.life<<endl;
fout<<S.attack<<endl;
fout.close();
cout<<"Character saved."<<endl;
}
i get this error:Code:void loadChar(Stats &S)
{
string choice;
cout<<"Name: "<<endl;
cin>>choice;
if ( !choice.is_open() ) {
cout<<"Character doesnt exist";
nameChar(S);
}
else {
end();
}
}
and its driving me crazy... anyone know why its doing that? i have a feeling its something simple, but i dont know what it isCode:[montez@localhost eternity]$ c++ eternity.cpp -o eternity -Wall -O2
eternity.cpp: In function `void loadChar(Stats&)':
eternity.cpp:152: error: `is_open' undeclared (first use this function)
eternity.cpp:152: error: (Each undeclared identifier is reported only once for each function it appears in.)