By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,075 Members | 946 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,075 IT Pros & Developers. It's quick & easy.

[C] double/float to string

P: n/a
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
Nov 14 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

--
a signature
Nov 14 '05 #2

P: n/a
Alan wrote:
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);

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #3

P: n/a
"Richard Heathfield" <do******@address.co.uk.invalid> wrote in message
news:c2**********@titan.btinternet.com...
Alan wrote:
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);


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

-Mike
Nov 14 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.