30 Ott 2002
Costruzione di Interfacce - Paolo Cignoni
22
Strdup con new
Dove
char *strdupnew(char const *str)
{
return str ? strcpy(new char [strlen(str) + 1], str) :
0;
}
questo per essere sicuri di non mescolare malloc e new
(strdup usa malloc!)