Solved

Visual C++ Int to CString?

Posted on 2004-03-21
2
585 Views
Last Modified: 2012-06-27
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
Comment
Question by:BearishSun
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 125 total points
ID: 10644541
You'd use

strReturn.Format ( "%s:%d", strA, iNumber);
0
 
LVL 86

Expert Comment

by:jkr
ID: 10644549
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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question