I have a file with data about animals, I read each line and process the information into my struct arrays but the issue is there is a space at the bottom of the animal file (and I cant simply delete it) so when I process the while loop it includes the line with the space. Any help would be great! Also my file looks like this: AnimalName:AnimalType:RegoNumber:ProblemNumber.
while (!infile.eof()) {
getline(infile, ani[i].animalName, ':');
getline(infile, ani[i].animalType, ':');
getline(infile, str, ':');
ani[i].Registration = stoi(str);
getline(infile, str, '.');
ani[i].Problem=stoi(str);
cout << "Animal added: " << ani[i].Registration << " " << ani[i].animalName << endl;
AnimalCount++;
i++;
}