The template vector list holds all the extracted links.
vector<string> links;The vector<string> is template notation to show that the vector class will hold strings. All of the functionality is in the class textfile which is instantiated with the path and name of the file to load in.
The design means that when the constructor has finished, the file will have been processed and the list of url will be complete. There are two main processes used.
- Read in the file into a string.
- Process the string into a list.
[/uol]
Reading the File
This uses the ifstream class to open the file. It then calls the seekg() function to move a file pointer to end of the file, calls tellg() to report its position i.e. indicate how big the file is. This is passed into reserve() so that the string starts as big as it needs to be. I've used a simple loop to read the file contents into the text string line by line. If you are searching a file, line breaks can be a real pain to deal with. Just in case any slipped through, the removecrlf() method converts them to spaces.On the next page - Processing the file

