Having problems capturing and sending all input, problem may be cin.ignore()?
Hello everyone!
i'm back, same project, different problem
Alright, When the user enters the input in the console, i used cin.getline(discription,101); This is just 1 example of what i used, and when i check out the output file, the first letter of the input is missing! Here is the code, and i also am attaching the output file... so u can see for yourself! here is the code for the addRecord();
PHP Code:
void Animal::addRecord()
{
ofstream outfile("inventory.txt",ios::ate);
if(!outfile)
{
cout<<"Unable to write to file\n";
}
else
{
I had to add taht cin.ignore, so it would prompt the user for each feild, such as: Type: German Shedpard [enter] Health: Good [enter] etc... , if you take them out, it will skip and do,
Type: Health: Good [enter], etc....
I have a feeling its skippping the first character of some of the lines, is becuase i put cin.ignore(); but if i take it out, it will cause even more damange, anyone have any suggestions on what i did wrong here is the output file...
As you can see, it cut off, in Location: it should say, Brockway or Dubois, PA, but insteed it says rockway,PA and ubois,PA