View previous topic :: View next topic |
Author |
Message |
JULIEN LAFFITTE
Joined: 28 Mar 2007 Posts: 20
|
printf whith float--> no negtive value |
Posted: Wed Apr 18, 2007 11:16 am |
|
|
float temperature2;
char Add_Radio[4];
printf("[%s200%8.2f]\r",Add_Radio,temperature2);
when i use this code all positive values on my rs232 terminal are good but not the negative.
Add_Radio[]=[210]
temperature2=-1
and the print stop like that:
[210200
what's the problem ?! :( |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Apr 18, 2007 12:57 pm |
|
|
Post a small test program, that you have compiled on your PC.
The code in your post is "typed in" code. It's far better if you
post a test program with real code. Also post your compiler version. |
|
|
JULIEN LAFFITTE
Joined: 28 Mar 2007 Posts: 20
|
|
Posted: Thu Apr 19, 2007 1:08 am |
|
|
PCWH version 4.032
my solution is :
sprintf(mystring,"[%s400%8.2f]",Add_Radio,temperature4);
printf("%s\r\n",mystring); |
|
|
|