Hi,

I wrote a small program, which uses filestream to read and write integer numbers. The segment of code is as following:

int i, j;
while (!from.eof()) { // from is the input file
from >> i >> j;
std::cout << i <<j;
}

The input file includes int numbers 1 2 3 4. I expected that the output is 1 2 3 4. But it turns out to be 1 2 3 4 3 4.
I can't figure out why it produces wrong result. Can someone give some ideas?

Thanks!