CString,string,char*,int間の変換
1407 ワード
1 string回転CString
2 CString回転string
3 Char*回転CString
4 CString相互転送char*
5 char*回転string
6 string char*
7 CString回転int
8 int転送CString
9 int回転string
10 string回転int
string srcStr= "222";int a = atoi(srcStr);
CString.format("%s",string.c_str());
2 CString回転string
UNICODE :
CString inStr;
setlocale(LC_ALL,"chs");
char* p = new char[...];//
wcstombs( p , str , str.GetLength() );
string outStr = p;
ASCII :
CString inStr;
string outStr = (const char*)str;
3 Char*回転CString
CSstring.format("%s",char*);
4 CString相互転送char*
CString strtest;
char * charpoint;
charpoint=strtest.GetBuffer(strtest.GetLength());
5 char*回転string
string s(char*);
6 string char*
char *p = string.c_str();
《C++ 》
C—string
1.data(), ”\0“
2,c_str(), ”\0“
3,copy()
7 CString回転int
CString ss="1212.12";
int temp=atoi(ss);
//CString aaa = "16" ;
//int int_chage = atoi((lpcstr)aaa) ;
8 int転送CString
CString aa;
aa.Format("%d",temp);
Format , 。
9 int回転string
int a = 2;
char p[NUM];//NUM
string desStr = itoa(a,p,10)// , 10 10 , a =10 ,itoa(a,p,16) ,desStr = "a";
10 string回転int
string srcStr= "222";int a = atoi(srcStr);