One of pieces of this code should help but you have asked very unclear question and it's hard to understand what indeed you're trying to do.
BTW as you can see Buffer
here is not initialized (actually all of them as others depends on Buffer
. It was intent to get some data to output.
#include <stdio.h>
int main(int argc, char **argv)
{
const int Size = 100;
unsigned char Buffer[Size];
unsigned char OutBuffer[Size];
unsigned char PrnBuffer[Size*3];
/* I have understanding you tried to output chars to OutBuffer but
you just need to iterate OutBuffer bytes the same way... */
int i = 54;
int j = 0;
do {
sprintf(&(OutBuffer[j]), "%c", Buffer[i]);
/* But why simply not outBuffer[j] = Buffer[i]; ?? */
i++;
j++;
} while(i != Size);
/* And now print this trash... */
for (i = 0; i < j; ++i)
{
sprintf(&(PrnBuffer[i*3]), "%02x ", OutBuffer[i]);
}
printf("%d: %s\n", j, PrnBuffer);
return 0;
}