1. 其它数据类型转换为字符串
(1) 将整数转为字符串
int i=123;
CString s;
s.Format("%d",i);
(2) 将double类型转换为字符串
CString str;
double pi = 3.1415926;
str.Format("%f",pi);
MessageBox(str);
2. 字符串转换为其他数据类型
(1) 将字符串转换为整型
int i;
String temp = "123";
i = atoi(temp);
(2) 将字符串转换为double类型
CString s="10";
double d = atof(s);