string type to convert char * type, there are generally three methods:
1.c_str () method
string name="Qian"; char *str=(char*)name.c_str(); printf("%s\n",str);
2.data () method
string name="Qian"; char *str=(char*)name.data(); printf("%s\n",str);
3.copy () method
string name="James"; char str[10]; name.copy (STR, . 5 , 0 ); // . 5 representative of the number of characters copied initial position, 0 replicated STR [ . 6 ] = ' \ 0 ' ; // be sure to add its own end of the string the printf ( " S% \ n- " , STR);
string type to int type
string str="1"; stringstream ss; ss<<str; ss>>a;
I.e., use as an intermediate is converted stringstream ss amount
int converted into type string type described above also