View Single Post
Join Date: Jan 2009
Posts: 7
Reputation: serhannn is an unknown quantity at this point 
Solved Threads: 0
serhannn serhannn is offline Offline
Newbie Poster

Re: searching for keywords in multiple text files

 
0
  #7
Jan 10th, 2009
Originally Posted by skatamatic View Post
As for the actual problem, I would go with a simpler method. Simply push all the keywords into a vector of strings, then load in the file to check against (a txt file) into another vector of strings. Then filter out the keywords manually, or get a little more elegant with a function such as SetIntersection() to find the similarities between the two, pushed into another vector. You can then use the resultant vector to do whatever parsing you wish (add the url info, etc)

This will cut your code down by about 70%, and will get you brownie points with your teacher =)
Thanks for the explanation, but I still don't understand how I can load text files, which I need to search, into a string vector. Should I get them line by line and load into a vector using "getline" or is there another thing to do?
Reply With Quote