Solved

convert unsigned char[] to const char

Posted on 1998-07-10
4
1,850 Views
Last Modified: 2013-11-19
just say I have the following variable defined as:

unsigned char label[32];

now in my program i want to call the following:
SetDlgItemText(IDC_STATIC, label);

but this gives the error:
"cannot convert parameter 2 from unsigned char[32] to const char *"

so how can I convert my unsigned char label[32] to a const char *??

0
Comment
Question by:Soth
[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
4 Comments
 
LVL 3

Accepted Solution

by:
Norbert earned 100 total points
ID: 1318998
Cast it like
SetDlgItemText(IDC_STATIC, (const char*)label);
0
 
LVL 2

Expert Comment

by:VEngineer
ID: 1318999

Using the standard C++ casting operator 'static_cast' instead of old C style cast notation:

SetDlgItemText(IDC_STATIC, static_cast<const char*>(label) );
0
 

Author Comment

by:Soth
ID: 1319000
worked like a charm!
thanx
0
 
LVL 3

Expert Comment

by:Norbert
ID: 1319001
what is the adtvantage usining static_cast ?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 216
iSeries FTP Exit Program 8 174
while loop over for loop 7 119
listing all the respondents to a twitter feed - Java 5 49
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Suggested Courses

710 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