fireflycn 发表于 2007-4-20 15:26:00

如何在CString与int型之间转换

<p>看我下面的一段函数,望各位高手指点指点,我实在是太菜了,</p><p>&nbsp;&nbsp; x,y,l,n都是CString型,我想要的结果就是:</p><p>假如&nbsp; x=10,y=10,l=50,</p><p>则a=“10,10”&nbsp; 转化成一个坐标</p><p>b=60;成为一个10+50=60的整数</p><p>c=“60,10”转化为一个坐标,即是b与10组合成的</p><p></p><p>{</p><p>UpdateData();<br/>&nbsp;&nbsp;&nbsp; CString a=x+","+y;</p><p>&nbsp;&nbsp;&nbsp;&nbsp;atoi(x);<br/>&nbsp;&nbsp;&nbsp; atoi(l);<br/>&nbsp;&nbsp;&nbsp; int b;<br/>&nbsp;&nbsp;&nbsp; b=x+l;</p><p>&nbsp;&nbsp; &nbsp;int b=0;<br/>&nbsp;&nbsp;&nbsp; CString d;<br/>&nbsp;&nbsp;&nbsp; d.Format("b=%d",b);</p><p>&nbsp;&nbsp;&nbsp;CString c=b+","+y;<br/>&nbsp; &nbsp;CString e;<br/>&nbsp; &nbsp;CAcUiDialog::OnOK();<br/>&nbsp; &nbsp;acedCommand(RTSTR,_T("POLYGON"),RTSTR,n,RTSTR,_T("e"),RTSTR,a,RTSTR,c,RTSTR,_T(""),RTNONE);<br/>}</p><p>&nbsp;&nbsp; 望高手帮我解决解决,该怎么改写这段函数,不胜感激啊!<br/></p>
页: [1]
查看完整版本: 如何在CString与int型之间转换