I have a string which I'm passing to a function by using a pointer, so that I can modify the string from within the function. Now, the problem I'm encountering is that I'm unable to deduce how to use the member functions of the object being pointed to.
1 2 3 4 5 6 7 8 9 10 11 12 13
int main()
{
string Str;
int Position_Found;
Find_String($Str,)
}
int Find_String(string *Input)
{
string Substring = "Whatever you want to look for here";
return *Input.find(Substring); //*Input represents "Str", but how can I perform the equivalent of "Str.find()" through the pointer?
}
A typo. I'm not actually using any of this code in a program yet, just testing out how to accomplish what I want.
I'm not really sure what you are meaning by "the equivalent of "str.find()".
.find() is a member function of str, but I was referencing str with a pointer, so the syntax ends up being a little different it seems. I had no idea that you could enclose *Input in parentheses, that's what I needed to know. I'll look up the -> operator and see what advantages that has as well. Thanks.