simplest way i can think of doing it is:
string temp = "cat"; char tab2[1024]; strcpy(tab2, temp.c_str());
for safety, you might prefer:
string temp = "cat"; char tab2[1024]; strncpy(tab2, temp.c_str(), sizeof(tab2)); tab2[sizeof(tab2) - 1] = 0;
or could be in this fashion:
string temp = "cat"; char * tab2 = new char [temp.length()+1]; strcpy (tab2, temp.c_str());
simplest way i can think of doing it is:
for safety, you might prefer:
or could be in this fashion: