string回転char*
string c++ ,
string
char
* 3 :
1。data
:
string str=
"abc"
;
char
*p=str.data();
2.c_str
:string str=
"gdfd"
;
char
*p=str.c_str();
3 copy
string str=
"hello"
;
char
p[40];
str.copy(p,5,0);
// 5, ,0
*(p+5)=
'\0'
;
//
cout < <p;
フォーラム討論に転載する.