Integers to CStrings

Aug 7, 2009 at 12:23pm
I know that in the standard library there's a class called stringstream that can be used to convert numeric types to strings and vice-versa but what about converting to CStrings in MFC. Does MFC support this kind of conversion and how would I go about doing so?
Aug 7, 2009 at 1:04pm
I don't think that CString in MFC has any kind of function that takes integer and convert it to string internally, what I suggest you can do is use wsprintf to convert integer to LPCSTR and then assign LPCSTR to CString
Aug 7, 2009 at 1:13pm
1
2
CString str;
str.Format("%d", 7);

Aug 7, 2009 at 2:37pm
Lol that works! Thanks kbw!
Topic archived. No new replies allowed.