ofstream data("character.data");
data << "health{ ";
data << maxHealth << " ";
data << health << " }" << endl;
bool quit = false;
data << "attackNames{ ";
for( int i = 0; true ; i++)
{
if( (attack[i].s != "}"))
{
data << attack[i].s << " ";
}
else
{
data << "}" << endl;
break;
}
}
data << "attackPower{ ";
for( int i = 0; true ; i++)
{
if( (attack[i].s != "}"))
{
data << attack[i].x << " ";
}
else
{
data << "}" << endl;
break;
}
}
data << "attackCost{ ";
for( int i = 0; true ; i++)
{
if( (attack[i].s != "}"))
{
data << attack[i].y << " ";
}
else
{
data << "}" << endl;
break;
}
}
everything works fine until it gets to data << "attackCost{ "
when i step through with gdb it does show that portion of the code executing exactly as it should, but anything from "attackCost{ " on doesnt show up in the file.
thanks in advance for any help anyone could give me.
Did you check the file after data has gone out of scope? Otherwise try flush data to make sure everything you have written to data is written to file.data.flush();