vendredi 24 avril 2020

What's the diffence between strstr() and std::string::find()?

why std::string::find() can handle '\0'? eg:

char* temp;
std::string str1;

for (int i=0; i <=12; i++) {
    str1.push_back(str[i]);
}

strstr(temp, "@#");// can not handle'\0' 
str1.find("@#");// success

Aucun commentaire:

Enregistrer un commentaire