Re-read a file

May 3, 2012 at 10:00am
Hello guys,
Is it possible to fin.open, fin.close then fin.open the same file again in one code? The reason why I want to do so is that I can have the computer to read the fin from the beginning once again. Or, alternatively, is there some code that I can use to have the computer to re-read the file?
Thanks.
Bosco
May 3, 2012 at 10:19am
Yes you can do that.

You can also run fin.seekg(0, std::ios::beg); to start reading from the beginning of the file again.
May 3, 2012 at 10:31am
Topic archived. No new replies allowed.