Resetting a ifstream object after reading the whole file
Hi,
I am reading a simple text file as following:
Code:
ifstream infile("doc.kml");
string line;
while (infile >> line) {
........
........
.......
......
........
}
So, after reading past the complete file; I now want to reset the ifstream object (here infile). So, that I can again start reading the file from the first line in the next part of the code. Can somebody please tell me how to do this?
I know, I could just close the file and open it back again, but isn't there some more straightforward method for this?
Thanks a lot in advance.