Hi, its me again,
How would I go about reading in the same file twice?? What I need to do is read it in the first time, and count how many lines there are between two words (in the middle of the file somewhere - see example below), create and array of that size, and then go back again and read in those lines and store them to the array I just created - or is there a way of extending an array on-the-fly?
Sample Text Document
Line Line Line Line Keyword Readthis Readthis readthiS Keyword Line Line
So there should be a count of 3, so an array of size 3 should be made, and then the three 'readthis' lines should be added to the array.
I currently have it searching for the keywords the first time, counting it up, then resetting it back to the beginning (using
myfile.seekg(0, ios::beg); ) and then re-reading it again with pretty much the same code but this time adding it to an array I just created. It works - but its doubled the amount of code I have - and looks messy.