sprintf x signed values
"Ricardo Raupp" <[email protected]> Sat, 26 Apr 2008 12:52:06 -0300
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers.coldfire |
|---|---|
| Message-ID | <00b701c8a7b5$7a87f9f0$c705050a@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.", sdata_8);
...
}
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 for sdata_16 ..and not -02 ...
Thanks guys ...
Ricardo Raupp