Bonjour,
Question simple mais sans r�ponse pour moi encore :
Comment convertir un Char* en string...?
Merci.
Version imprimable
Bonjour,
Question simple mais sans r�ponse pour moi encore :
Comment convertir un Char* en string...?
Merci.
Si je ne dis pas de betise quand tu fais:
Code:
1
2
3
4
5
6
7
8 // Ton char * char * s = "coucou"; // Ton string string s2; // Tu assigne ton char * a ton string s2 = s; // Tu affiche ça marche cout << s2 << endl;
std::string::string(const char*) et std::string::operator=(const char*) copient la cha�ne C fournie (termin�e par le caract�re nul).
Juste un truc, si tu convertis depuis un char* et non pas un const char*, oublie pas de d�salouer apr�s ;)
AH! Merci, effectivement, faut le savoir �a!