C++ weird error strstr -
check screenshot, have no idea what's wrong it
can me?
if (strstr(pmaterial->gettexturegroupname(), "world textures")) { pmaterial->colormodulate(0.5, 0.5, 0.5); }
1: c2665 'strstr': none of 2 overloads convert argument types
2: e0304 no instance of overloaded function "strstr" matches argument list
your gettexturegroupname()
function of std::string type. std::strstr() function not accept std::string
parameter. use string c_str() member function instead:
if (std::strstr(pmaterial->gettexturegroupname().c_str(), "world textures")){ pmaterial->colormodulate(0.5, 0.5, 0.5); }
rather falling c style strings should explore std::string
facilities pointed out in comments. modified example uses std::string::find member function:
if (pmaterial->gettexturegroupname().find("world textures")!= std::string::npos){ pmaterial->colormodulate(0.5, 0.5, 0.5); }
Comments
Post a Comment