Yeah, Hello. I know there alot of getline() post but tehy didnt help me in my problem.
It complies fine but because you have to select a save slot before you enter a name it skips right past the getline(); and gives save1 a name of 0 meaning NULL I guess.Code:int Save() { ifstream fins1("Saves/save1.fss"); ifstream fins2("Saves/save2.fss"); ifstream fins3("Saves/save3.fss"); ifstream fins4("Saves/save4.fss"); fins1>>save1; fins2>>save2; fins3>>save3; fins4>>save4; fins1.close(); fins2.close(); fins3.close(); fins4.close(); cout<<"\nWARNING!: Saving a game will over-write the old saved game.\n"; int sel=0; cout<<"\nPlease select a slot to save in:\n"; cout<<"Slot 1:"<<save1<<"\n"; cout<<"Slot 2:"<<save2<<"\n"; cout<<"Slot 3:"<<save3<<"\n"; cout<<"Slot 4:"<<save4<<"\n"; cout<<"5:Cancel\n"; cout<<"Save in which slot or cancel?"; cin>>sel; switch (sel) { case 1: { ofstream fouts1("Saves/save1.fss"); cout<<"Enter save name?"; cin.getline (save1, 255); fouts1<<save1<<"\n"; fouts1<<intel<<"\n"; fouts1<<str<<"\n"; fouts1<<day<<"\n"; fouts1<<hour<<"\n"; fouts1<<clr<<"\n"; fouts1<<salary<<"\n"; fouts1<<money<<"\n"; fouts1<<TRtimeleft<<"\n"; fouts1<<TRpdt<<"\n"; fouts1<<pelletsdropedt<<"\n"; fouts1<<numfish<<"\n"; fouts1.close(); return Menu(); } break;