Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 592
  • Last Modified:

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
0
BearishSun
Asked:
BearishSun
  • 2
1 Solution
 
jkrCommented:
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now