Solved

typecast

Posted on 2001-08-06
2
190 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
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 20 total points
Comment Utility
>>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
Comment Utility
Ooops, that one got accepted pretty quickly :o)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 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 clear a vector as well as how to detect empty vectors in C++.

762 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now