thank you guys for the help.
the (char*) is unnecessary.
maybe will stay with strcpy, unless there is benefit on it. as I am trying not to mix free and delete in the same project. easy for me to mess up.
None of the mentioned methods is "best", because of two reasons:
1) c_str() may actually reallocate a string, if there is no place for an additional character. This is redundant.
2) strcpy, strdup determine length of the string using O(n) algorithm. But we already know this length.
I suggest:
1 2 3 4
std::string s = "...";
char * c = newchar [s.size()+1];
std::copy(s.begin(), s.end(), c);
c[s.size()] = '\0';