[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


unsigned char  to char

Posted on 2006-05-19
Medium Priority
Last Modified: 2013-11-20

it's simple question

How to convert (unsigned char * Data) on method arrgument to

char buffer[256];

mean  buffer contain Data

Question by:newnewmommon
  • 2
LVL 14

Accepted Solution

wayside earned 500 total points
ID: 16719820
You can use strncpy, casting the input to char *:

char buffer[256];
strncpy(buffer, (const char *)Data, 255);
buffer[255] = 0;

LVL 14

Expert Comment

ID: 16719846
You might also want to consider using a CString rather than a character buffer (this is the MFC topic after all):

CString buffer(const char *Data);

then you don't need to worry about whether your buffer is big enough to hold the data.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

834 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