how to copy from uint to char[] ?

Posted on 2004-11-07
Last Modified: 2008-03-17
i have a problem here...........

in my program, i have

char OutputString[20];
uint8_t Message_Digest[20];


then i have
for(i = 0; i < 20 ; ++i)
     printf("%02X ", Message_Digest[i]);
which gives me what i wan. but how do i copy the output into the OutputString ? so that OutputString contains all the

printf("%02X ", Message_Digest[i]); from i=0 to 19...
Question by:harsher
    LVL 11

    Accepted Solution

    You need to do something like this:
    1) OutputString should be much bigger than 20
    2) And...
    char OutputString[62];
    int i;
    int outlen = 0;
    for(i=0;( i < 20 );i++) {
      outlen += sprintf( &(OutputString[outlen]), "%02X ", Message_Digest[i]);

    Author Comment

    thanx very much... ur da man!!!!!!!!!
    LVL 11

    Expert Comment

    You are welcome

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
    This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
    Video by: Grant
    The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
    The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

    737 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

    18 Experts available now in Live!

    Get 1:1 Help Now