• string to char*

std::string str = “Hello Word”;
char* mychar = str.c_str();

  • char* to string

std::string str0 = “Hello Word”;
std::string str1;
strcpy(str1,str0.c_str());  // strcat to add

Reference:

http://www.flounder.com/cstring.htm

    
坐看云起时 based on WordPress, RSS and comments design by Gx3.