Hi
I have a very simple sprintf question.
int STATUS = 0;
char test[100];
int n = sprintf( test,"%04x", STATUS );
printf ("[%s] is a %d char long string\n",test,n);
for(i=0 ; i<4 ; i++) {
printf("%02x", test[i]);
}
printf("\n\n");
The output of this code is 30303030 which is not what I intend to have as output. Basically, I would like to have 00000000 as output, so integer value should occupy 4 bytes in my output with its actual value. Can anybody tell me what I did wrong?
Thanks