So how do I get an ifstream object to start at the top of the file again, if its already read some lines with getline() and/or is already at the end of the file?
I'm using the global getline() function which has a prototype of the following:
I tried calling ios::clear() before the getline call, but it didn't work. The ifstream object is still at the end of the file after the call to ifstream_object_name.clear().Code:istream& getline ( istream& is, string& str );
After attempting that, and it not working, I went and looked at the reference to ios::clear(), and learned it only clears the error flags. It doesn't reset the input filestream to the top of the file, unfortunately. So how do I do that?