Hello there,
im writing code for my asteroids game and am nearly finished but ive come across a problem when trying to load the file
the save game is written like this and works perfectly fine, it saves the things i want to a text file:
void WrapGame::save()
{
cout<<"enter the filename (Max 20 characters)"<<endl;
cin>>Filename;
ofstream saveGame(Filename, ios::out);
saveGame<<gameState<<"\n"<<score<<"\n"<<health<<"\n"<<lives;
saveGame.close();
}
The load game function however throws me a red line under the first >> after savegame on the last line of the function is called
void WrapGame::load()
{
cout<<"Enter the name of the file you wish to load:"<<endl;
cin>>Filename;
ifstream saveGame(Filename, ios::in);
saveGame>>gameState >> score>>health>>lives;
}
where am i going wrong?
any help would be awesome
cheers
Benny