MFC: changing int to string

Home Forums C Programming MFC: changing int to string

This topic contains 2 replies, has 2 voices, and was last updated by  sameena 11 years, 9 months ago.

  • Author
    Posts
  • #1928

    sameena
    Member

    Hi

    Can anyone give guidance on changing a int var to a string for display in AfxMsgBox?

    Thanks

  • #3177

    arun_raj7
    Member

    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.

  • #3178

    sameena
    Member

    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:-

    Apparrently you can do this and other wonderful things with the CString class :)

    Thanks again
    MegaC

You must be logged in to reply to this topic.

0 Shares
Share
+1
Tweet
Share
Stumble