- This topic has 2 replies, 2 voices, and was last updated 18 years, 9 months ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › MFC: changing int to string
Hi
Can anyone give guidance on changing a int var to a string for display in AfxMsgBox?
Thanks
You can use any of c functions in c++ or mfc as long as you include the correct headers.
Also I believe the correct syntax for that would be itoa(VartoShow,&ChatToConvert,10);
You use the ampersand character to point to the string, you cant automatically put a string into a function parameter in accordance to how c++ conducts itself.
Hi Gentlemen
Thanks for the help. I had tried the itao function but did not provide correct parameters. However this is the solution I came up with:-
1 2 3 4 5 6 | <br /> int iNumRecords=400;<br /> //CString m_sCountText=iNumRecords;<br /> CString m_MyTex;<br /> //s.Format(_T("%d"), total);<br /> m_MyTex.Format(_T("%d"),iNumRecords); |
Apparrently you can do this and other wonderful things with the CString class :)
Thanks again
MegaC