I am working with C++ and I am trying to compare strings.
Below is my code which gives me back const char* -
const char* client_id() const {
return String(m_clientPos);
}
And now I am comparing the strings like this -
cout<<client_ptr->client_id()<< endl;
if (strcmp(client_ptr->client_id(), "Hello")) {
..
} else {
..
}
but it never goes into if statement. But my cout prints out Hello correctly. Is there anything wrong I am doing?
m_clientIdPostostringif the return type isconst char*?Stringis not built in type, (did u meanstring?). if there is a user definedStringtype, then the code will not compile