ricardo ricardo

sprintf x signed values

Discussion created by ricardo ricardo on Apr 26, 2008
Latest reply on Apr 26, 2008 by ricardo ricardo
Hi people
I´m working with 52235 and I´m trying to print a negative value for a char (int8) wich is -2, by using sprintf function, but the output is "254".  
I did:
{
 
int8 sdata_8;
 
   sdata_8=-2;
   sprintf(lcd_controller.text_data_array,"   %hi.%01u",
           sdata_816/10,
 
I did the same experience using int16 and so I had success..
Is there some special care to use sprintf with char?
 
By the way, how can copy a negative value of a int8 to a int16?
I tryied:
sdata_16=sdata_8; and I got the calue 254 ..not -02 ...
 
Thanks guys ...
Ricardo Raupp
 

Outcomes