?
Solved

typecast

Posted on 2001-08-06
2
Medium Priority
?
200 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

Technology Partners: 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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

770 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