[C] double/float to string

A

Alan

hi,

are there any functions that can change double and float to string ?

and is it possible to change the double/float to string which only contains
decimal format instead of exponent expression?

thx
 
T

those who know me have no need of my name

in comp.lang.c i read:
are there any functions that can change double and float to string ?

and is it possible to change the double/float to string which only contains
decimal format instead of exponent expression?

yes and yes.
 
R

Richard Heathfield

Alan said:
hi,

are there any functions that can change double and float to string ?
sprintf

and is it possible to change the double/float to string which only
contains decimal format instead of exponent expression?

sprintf(yourstringgoeshere, "%f", yourdoubleorfloatgoeshere);
 
M

Mike Wahler

Richard Heathfield said:
sprintf(yourstringgoeshere, "%f", yourdoubleorfloatgoeshere);

And as to your second question, look up the 'width' and
'precision' flags for 'printf()' format specifiers.

-Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top