After I reach EOF, how can I change the location of the pointer reading the file? I've tried:
F.seekg(ios::beg);
F.seekg(0,ios::beg);
F.seekg(0);
tellg still returns -1.
After I reach EOF, how can I change the location of the pointer reading the file? I've tried:
F.seekg(ios::beg);
F.seekg(0,ios::beg);
F.seekg(0);
tellg still returns -1.
Try calling clear() before seekg.
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
When you hit EOF some of the error flags are set to true and in order to reset those flags,Try calling clear() before seekg.