Reseting the get pointer

I've tried closing and opening the fstream, and ive tried using seekg( 0, ios::beg ) but those arent working for me. Right now i have a function that reads through the file once to read how many lines there are, then once that while loop breaks i try to reset it to look through the file again for different characters. Any ideas?

EDIT***: Changed it so the counting lines is in a different function but its still not working.
Last edited on
closed account (S6k9GNh0)
Give us the code. From what you make it sound like it should be working. So just post the code so we can get a better look. Be sure to use BBTags.
Last edited on
Since the stream object has encountered eof it is in a bad state, so you must clear it with fstrObj.clear();. Then you can fstrObj.seekg(0); without needing to close and reopen the file.
Last edited on
i think seekg(0) is right for bringing pointer to beginning of a file.
Topic archived. No new replies allowed.