I am using eof in a while loop, and it is reading in one extra time at the true end of file, resulting in repeated data.

I read the other posts on this, but could not figure out how to use fgets, which is how the FAQ explains it. is fgets C++ code or C?

in short, is there another way to check for the end of file reliably? here's my code:

while(!fIn.eof()) {
fIn.get(ch);
++x;
}