Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to use sprintf in sdcc for folating point variables

Status
Not open for further replies.

vikrant

Junior Member level 2
Joined
Jun 30, 2006
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,425
sdcc sprintf

hi all,
i am doing some floating point calulation in p89v51rd2 uC in sdcc compiler it is happenning properly. But i want to use sprintf for floating point operation.

ex.
float f1 = 1.23;
char buffer[10];

sprintf(buffer,"%f", f1);

but buffer is not getting filled with proper floating point variable value as it has to be.
Can anybody have any library in which sprintf support floating point variables.

Please help
 

sprintf sdcc

hey vikrant....do you really sure that the value isn`t in the buffer? how do you checked this? try inserting a printf after, to debug...it seems right to me...


or, try to use

sprintf(buffer,"%+5.2f", fl1);

formating the buffer...


regards

Breno
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top