unknown error

i know im probably making a noob mistake here but i cant seem to get the following code to work
1
2
3
4
5
6
7
8
9
string gotofunc (string x)
{
	char found;
	string str1 = "goto";
	string str2 = "go to";
	string str3 = "go";
	found=x.find(str1,str2,str3);
	return 0;
}

it keeps returning error: no matching function for call to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(std::string&, std::string&, std::string&)'
even though i did declare #include <string>

closed account (jwC5fSEw)
That's not how find works. Read here: http://cplusplus.com/reference/algorithm/find/
i need to find something in a string not an array or range
u r returning an integer instead of returning of type string
Maybe strstr from string.h? Be sure to have the value stored in a char*.

-Albatross
Last edited on
thanks i got it :D
So what was wrong there?

And what did you do to fix it?
string::size_type found = x.find(str1,0) is the corrected synatx and also i keep getting a freed pointer error....how do i fix that?
Topic archived. No new replies allowed.