I am reading a CSV file and parsing its content into tokens. Now i want to know how to check for End of File. I am giving my code to be more clear.
ifstream file(filename);
if (file)
{
char ch ;
do
{ file.getline(line, SIZE);
tmp =static_cast<string>(line);
vector <string> array;
string token;
istringstream iss(tmp);
int i=1;
while ( getline(iss, token, ',') )
{
array.push_back(token);
v_List.SetItemText(nItem, i, token.c_str());
i++;
}
// }//cin.get();
}while(ch=EOF); // Here i have to check for EOF but this one enters an infinite loop.
Help me !