I'm having trouble loading some chars from a file... I made a code to previously save things into a file, and that works fine. I can't get the loading to work though ( like a load game function ). Here is the code :
This is only part of the code. All chars and ints have been declared. TYPE is a function for a typewriter effect, so treat it as cout.Code:type("What was your filename ?"); cin >> filename; infile.open(filename, ios::nocreate); infile >> firname; infile >> lasname; infile >> sex; infile >> location; infile >> weapon; infile >> bplace; infile >> bday; infile >> bmonth; infile >> byear; infile >> age; type("Your name :\n"); type(firname); type("\n\nyour character's last name ?\n"); cout << lasname; type("\n\ncharacter male or female ?\n"); cout << sex; type("\n\nWhere is your character in the game ?\n"); cout << location; type("\n\nWhat is your character's primary weapon ?\n"); cout << weapon; type("\n\nWhat is your character's birthplace ?\n"); cout << bplace; type("\n\nWhat is your character's birthday ? [Day only]\n"); cout << bday; type("\n\nWhat is your character's birth month ?\n"); cout << bmonth; type("\n\nWhat is your character's birth year ?\n"); cout << byear; type("\n\nTherefore what is your character's age ?\n"); cout << age; Sleep(500); cin >> xit; return 0; }
Can anyone tell me why, when I launch this program, I get :
"Your name is :"
"Your age is :" etc..
instead of
"Your name is :"
"NAME"
"Your age is :"
"AGE".
Thanks for your help.



LinkBack URL
About LinkBacks



