I have a code like:
int contains(LPCTSTR name)
{
char * data = "test.txt";
}
How can i check whether name
contains 'data'? Thanks!
There is a function called strstr
that is used to check for if a string contains another string. However, since you are using LPCTSTR
you should note that it can be different depending on your project settings. If you read more in the linked manual page you will see it mention _tcsstr
which is a macro that will expand to the correct function.
If you use C++ std::string
instead, there is the find
method.