I'm reading in data from a file that has three columns. For example the data will look something like:
3 START RED
4 END RED
To read in the data I'm using the following check:
while (iFile.peek() != EOF) {
// read in column 1
// read in column 2
// read in column 3
}
My problem is that the loop usually does on extra loop. I'm pretty sure this is because a lot of text editors seem to but a blank line after the last line of actual content.
I did a little bit of Googling and search on SO and found some similar situations such as http://stackoverflow.com/questions/21647/c-reading-from-text-file-until-eof-repeats-last-line however I couldn't quite seem to adapt the solution given to solve my problem. Any suggestions?