C++ detecting end of file
- by xbonez
I have a C++ program that is reading in info from a file, that stores info seperated by "$$$$". An example of how the file looks is:
abc
bcd
$$$$
def
$$$$
qwe
gfh
$$$$
How can I detect the file has ended, without using the eof() function?
I have it set like this,
getline(sin,temp)
if (temp=="$$$$")
{
}
After reading the last set of four dollars, how can I check the next line to ensure another set of data isn't beginning, and that the file has ended? If the file has indeed ended, I plan on using a boolean flag to terminate the while loop.