c++ - Compare two strings (but different types of) -


in c++ program, need compare if 2 strings equals or not :

taglib::string artist1 = f.tag()->artist(); 

(see http://taglib.github.io/api/classtaglib_1_1string.html)

and

argv[2] 

(which comes int main(int argc, char *argv[])).

i tried lots of ways it, don't succeed : artist1 != argv[2] doesn't work, strcmp(artist1,argv[2]) doesn't work well, etc.

thanks in advance.

you try this:

 artist1.to8bit() != argv[2] 

according documentation, function to8bit() should return object of type std::string(), overload of operator != accepting const char* available.

just make sure include appropriate header before:

 #include <string> // <== need work std::string 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -