Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

typecast

Posted on 2001-08-06
2
Medium Priority
?
206 Views
Last Modified: 2010-04-02
I am trying to convert a int into a CString and when i do that i get symbols.

This is what i am using

int labelid = 18548;
CString labelname = "holder";
labelname += " - ";
labelname += CString(labelid);

when doing this i do not append the number.
0
Comment
Question by:holiday1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 80 total points
ID: 6357150
>>labelname += CString(labelid);

That won't work - however, you could use the 'Format' member of CString:

CString num;

num.Format ( "%d", labelid);

labelname += num;

0
 
LVL 86

Expert Comment

by:jkr
ID: 6357159
Ooops, that one got accepted pretty quickly :o)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

604 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