void Load_from_file()
{
ifstream fin("Data.txt");
//fin.open("Data.txt");
if (!fin.is_open())
cout << "Error while opening the file" << endl;
else
{
int f_id;
int u_id;
int priority;
char acc_type;
char delim;
while (!fin.eof())
{
fin >> f_id;
fin >> delim; // skipping the comma
fin >> u_id;
fin >> delim;
fin >> priority;
fin >> delim;
fin >> acc_type;
}
fin.close();
}
}
Data in the file is :
7551,10,3,R
25551,3,10,W
32451,4,7,R
The while loop should end after third iteration but it terminates after fourth iteration