This will never be true because you are comparing pointers, not the contents of a string. Another reason you should use std::string (the comparison operator will compare the string itself for this).
Using this method, you can use strcmp , the C ++ method is to use std :: string and rely on its comparison operators (namely operator== ). But since it is tagged with C ++, I highly recommend that you use std::string .
You can find the documentation for strcmp here , and for std::string .
source share