i want to convert char array element into hexadecimal value. But the code i wrote is not giving the output as i expect.

unsigned char in[256];

void Text(const char *Buffer)
static char tempValue[256];

    for(int i=0;i<=len;i++)
        	sprintf(&tempValue[i],"%02x", (unsigned char)Buffer[i]);
		in[i]=(unsigned char)tempValue[i];

this is not working as i wanted.
i want..

unsigned char in[] = {0x0044,ox0055,.....};

can anyone help me to correct this...

you can try something like this: But your tempValue buffer may not be large enough, depending on the length of the string. Should be at least string length * 7, maybe larger.

char temp[16];
tempValue[0] = 0;
// put below in a loop for each character
sprintf(temp,"0x%04X, ", Buffer[i]);
strcat(tempValue, temp);