[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 508
  • Last Modified:

how to copy from uint to char[] ?

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...
0
harsher
Asked:
harsher
  • 2
1 Solution
 
dimitryCommented:
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]);
}
0
 
harsherAuthor Commented:
thanx very much... ur da man!!!!!!!!!
0
 
dimitryCommented:
You are welcome
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now