whenever I run the program in the second run, it keeps running in the while loop I don't know why. the file is storing an array of a struct.
int readFile(int num, string fName, player players[]){
ifstream oFile;
oFile.open(fName.c_str(), ios::in);
if(oFile.is_open()){
while(!oFile.eof()){
getline(oFile, players[num].name);
oFile>>players[num].id;
oFile>>players[num].age;
oFile>>players[num].gender;
num++;
}
num--;
}
else
cout<<"dosent open";
oFile.close();
return num;
}