unsigned char  to char

Posted on 2006-05-19
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
    LVL 14

    Accepted Solution

    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

    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

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
    If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
    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.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    746 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

    16 Experts available now in Live!

    Get 1:1 Help Now