1.char[] to string
char buf[] = "abcd"; string str; str.assign(&buf[0], &buf[strlen(buf)]);
2.string to char *
string strDate = "test"; char * cData = const_cast<char *> (strDate.c_str());