CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

printf whith float--> no negtive value

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JULIEN LAFFITTE



Joined: 28 Mar 2007
Posts: 20

View user's profile Send private message

printf whith float--> no negtive value
PostPosted: Wed Apr 18, 2007 11:16 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 18, 2007 12:57 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Apr 19, 2007 1:08 am     Reply with quote

PCWH version 4.032

my solution is :
sprintf(mystring,"[%s400%8.2f]",Add_Radio,temperature4);
printf("%s\r\n",mystring);
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group