Rereading files

After reading a file, how does one go back to the beginning? I basically want to "search" a file.
1
2
3
4
5
ifstream infile("myfile.dat",ios::binary); //open for reading

//read some

infile.seekg(0,ios::beg); //go back to the beginning 

Topic archived. No new replies allowed.