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

  • 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
  • 2
1 Solution
You'd use

strReturn.Format ( "%s:%d", strA, iNumber);
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;

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