Split string up into single words
As some of you well know (since I have been asking so many questions in the forum) I am creating an HTML book given a simple text file as input. I am also creating an index of certain terms in the book. Right now I have the book output implemented and am now starting on the index portion. I have this loop right here that takes each line and adds the line to a vector:
Now I need to put a function in here that basically splits the "line" variable up into single words then takes those words and passes them to my index function named "addWord." I have tried using substr and doing line.find(' ') and it gives runtime errors. Any help would be appreciated.
for(int lineNumber = 0; lineNumber < MAX_LINES_PER_PAGE; lineNumber++)
string line = book.readLine();
current.output(out, book.theTitle, pageNo, nextPageNo, prevPageNo);