Finding files going through a loop

Hi,

I have set up a loop which I think should output the file each time it is found.

E.g using the code below, I think it should be going through findwords 5 times (5 values in it) and each time when it finds the word at findwords[j] it should say (the bottom line of code) where each one was found. There are 5 items so each time looped it should find an item. Currently it only displays the first one.

Any ideas why?
Thanks.

1
2
3
4
5
6
7
8
9
10
	size_t found;
	for (int j = 0; j < findwords.size(); j++)
	{
		
		found=textFile.find(findwords[j]); 

		if (found!=string::npos)
		cout << "first word (" << findwords[j] << ") found at: " << int(found) << "\n" << endl;

	}
Topic archived. No new replies allowed.