Reputation: 1695
I just tried this, but don't work, maybe because I'm reading character by character?
char character;
while (!file.eof()) {
character = file.get();
cout << character;
}
Upvotes: 1
Views: 3092
Reputation: 1695
OK, it works. The trick is call
file.clear();
file.seekg(0, ios::beg);
just after the iteration. Sorry :(
Upvotes: 0
Reputation: 93890
If your input is a stream (data piped in from another program) then you will not be able to seek.
Upvotes: 0