请教int,double和CString如何相互转化?
请教如何把int,double 转化为CString????回复
<BR> // ----- AsdkintToCString._test command (do not rename)<BR> static void AsdkintToCString_test(void)<BR> {<BR> // Add your code for command AsdkintToCString._test here<BR> int a = 5;<BR> double b = 1.25;<BR> CString str;<BR> str.Format("%d", a);<BR> acedAlert(str);<BR> str.Format("%.2f", b);<BR> acedAlert(str);<BR> } 多谢版主!!! (1)CString转化为intCString strCount = "2";
int n = atoi(strCount.GetBuffer(0));
strCount.ReleaseBuffer();
(2)CString转化为float
CString strCount = "2.0";
float f = atof(strCount.GetBuffer(0));
strCount.ReleaseBuffer(); <IMG alt=发贴心情 src="http://www.mjtd.com/bbs/skins/default/topicface/face1.gif" border=0> <B></B><BR>谢谢啦
页:
[1]