How can I convert an Int to a CString?

Java Player picture Java Player · Sep 26, 2012 · Viewed 98.6k times · Source

I can convert a Double to a CString using _ecvt

result_str=_ecvt(int,15,&decimal,&sign);

So, is there a method like the one above that converts an int to CString?

Answer

dsgriffin picture dsgriffin · Sep 26, 2012

Here's one way:

CString str;
str.Format("%d", 5);

In your case, try _T("%d") or L"%d" rather than "%d"