I have a .txt file with 5 lines of text. Each line is a different quote that a character in the main function will be saying. I am using an ifstream and a getline in the main function for each time he says something.
My problem is that when I get to the end of the file, I need to go back to the beginning to get the same lines again. How do I do this?
You have two choices. One, you could use one of the member functions of ifstream to move it back to the beginning, or you could close and re-open the same file.
However, you could also just store the text into a vector of strings, and read that so you only have to read the file once. What exactly are you going to do with the data?