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

convert float to string

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



Joined: 02 Jul 2008
Posts: 27

View user's profile Send private message

convert float to string
PostPosted: Mon Aug 11, 2008 4:39 am     Reply with quote

Hy!

I'm looking for a function which converts a float variable into a string. It should work in reversion of atof.

I know printf does this, but is it possible to store the output of printf into a varialbe?

Or exists there any funtion doing the opposit of atof?
Indy



Joined: 16 May 2008
Posts: 24

View user's profile Send private message

PostPosted: Mon Aug 11, 2008 5:39 am     Reply with quote

Use sprintf.
Code:
char my_string[10];
float my_float=12.345;

sprintf(my_string, "%f", my_float);
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