std::find help

So I have this code example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
	std::ifstream bindings;
	std::string line;
	bindings.open("keys.cfg.txt");
	while(std::getline(bindings,line))
	{
		std::stringstream keystream(line);
		std::string callbackName;
		keystream >> callbackName;

		while(!keystream.eof())
		{
			std::string keyval;
			keystream >> keyval;
			int end = keyval.find("!");
			std::cout << end << std::endl;
		}
	}


The textfile contains the word "Hello World!"


Dont understand why am i getting the result of 5?
Last edited on
What did you expect?

Remember std::string.find() is zero based, just like arrays.

Topic archived. No new replies allowed.