std::string s("some text to search for");
if(s.find("text to search") != std::string::npos)
// "text to search" was found in string
// "text to search" wasn't found in string
I guess... your question is sort of vague.
You've also got substr that you can employ; as for the file, if you're reading lines, use getline(std::ifstream_obj, std::string_var) and perhaps some flavor of the above. If you're breaking on whitespace, use the extraction operator >> (std::ifstream_obj >> std::string_var) and perhaps a comparison test std::string_var == some_string
As for a function, it depends on what you're wanting to do, I think... if the string is present, then perhaps return a boolean; if you want its position within a string, then perhaps return an integer; if you want the string, then return a string.