Visual C++ Int to CString?

Can someone tell me how to convert int variable to CString one, and other way around? Examples for both would be really nice.

I read something about atoi, but havent figured it out, what is radix?

iNumber = 40;
strReturn = strA + ":" + iNumber;

I'm new, dont laugh :P
BearishSunAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jkrConnect With a Mentor Commented:
You'd use

strReturn.Format ( "%s:%d", strA, iNumber);
0
 
jkrCommented:
BTA, you could also use '_itoa()' (a radix is the numerical base, e.g. 2 in the binary and 10 in the decimal system), but it'd be more cumbersome:

   char buffer[20];
   int  iiNumber = 40;
 
   _itoa( iNumber , buffer, 10 );

   strReturn = strA + ":" + buffer;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.