字符串转化为其他数据类型:
strcpy(temp,"123");
短整型(int) i = atoi(temp); 长整型(long) l = atol(temp); 浮点(double) d = atof(temp);
其他数据类型转换到CString
使用CString的成员函数Format来转换,例如:
整数(int) str.Format("%d",i); 浮点数(float) str.Format("%f",i); 字符串指针(char *)等已经被CString构造函数支持的数据类型可以直接赋值 str = username;
strcpy(temp,"123");