I'm working on some code that reads info from a file and stores it in a structure. It's working on all the files I throw at it with lots of different errors in them except for one. When there is an error in the file it's skipping the line that follows it and I'm not sure why. My code is below:
void readFile(char fileName[], accessRecord file[])
{
ifstream fin(fileName);
int i = 0;
while (fin.good())
{
fin >> file[i].fileName >> file[i].userName
>> file[i].timeStamp;
i++;
if (fin.fail())
{
fin.clear();
fin.ignore(256, '\n');
}
}
fin.close();
}
This is the File that is causing issues.