I''m making a simple text parser class for the scripting language I''ve been working on for a while. I''ve never done anything with text parsing before (at least not as advanced as this compiler-like thingy), so I expected to get stuck pretty fast, which happened. Although not in the way I expected.
I have a
std::ifstream
as a private member of this class, and at the start of the main parsing function, I open a file with it, loop through the entire file, do some stuff with the contents and then close it again.
Now when I want to reopen the file, it just won''t work. The reopening code looks like this:
fin.close();
fin.open(file);
The file is closed and then reopened, nothing inbetween, and the filename is the same, both in this second call to open, and in the open() at the beginning of the function.
Why does it do this? It doesn''t make sense to me.
"For crying out loud, she has fishes coming out of her head on either side. How can you find this hot?!"
"If anyone sees a suspicious, camouflaged factory being carried across the desert, they should report it
immediately."