Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > [C] double/float to string

Reply
Thread Tools

[C] double/float to string

 
 
Alan
Guest
Posts: n/a
 
      03-07-2004
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


 
Reply With Quote
 
 
 
 
those who know me have no need of my name
Guest
Posts: n/a
 
      03-07-2004
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
 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      03-07-2004
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 : http://www.velocityreviews.com/forums/(E-Mail Removed)
"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
 
Reply With Quote
 
Mike Wahler
Guest
Posts: n/a
 
      03-07-2004
"Richard Heathfield" <(E-Mail Removed)> wrote in message
news:c2ei04$5ma$(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'System.String[]' from its string representation 'String[] Array' =?Utf-8?B?UmFqZXNoIHNvbmk=?= ASP .Net 0 05-04-2006 04:29 PM
Is "String s = "abc";" equal to "String s = new String("abc");"? Bruce Sam Java 15 11-19-2004 06:03 PM
String[] files = {"a.doc, b.doc"}; VERSUS String[] files = new String[] {"a.doc, b.doc"}; Matt Java 3 09-17-2004 10:28 PM
String.replaceAll(String regex, String replacement) question Mladen Adamovic Java 3 12-05-2003 04:20 PM
Re: String.replaceAll(String regex, String replacement) question Mladen Adamovic Java 0 12-04-2003 04:40 PM



Advertisments