float to string
How do you convert a floating point number to a string in C++?
Thanks,
miro
Try using this function:
char *_fcvt( double value, int count, int *dec, int *sign );
It's declared in "stdlib.h"
From Online MSVC docs:
//Gaijin
Edited by - Gaijin on August 25, 2000 8:04:50 PM
char *_fcvt( double value, int count, int *dec, int *sign );
It's declared in "stdlib.h"
From Online MSVC docs:
Parameters value Number to be converted count Number of digits after decimal point dec Pointer to store decimal-point position sign Pointer to store sign indicator
//Gaijin
Edited by - Gaijin on August 25, 2000 8:04:50 PM
// Gaijin"There is only one way to find out if a man is honest...ask him. If he says yes, you know he is crooked." -- Groucho Marx"Sex isn't the answer. Sex is the question. 'Yes' is the answer" -- Unknown
You can use
char *_gcvt( double value, int digits, char *buffer );
Returns the ptr to buffer
value:Value to be converted
digits:Number of significant digits stored
buffer:Storage location for result
I hope this works for ya
char *_gcvt( double value, int digits, char *buffer );
Returns the ptr to buffer
value:Value to be converted
digits:Number of significant digits stored
buffer:Storage location for result
I hope this works for ya
A man on the move, and just sick enough to be totally confident.Damn Right!
baskuenen: That function does exactly the opposite, converts a string to a floating point value (as I''m sure you know )
// Gaijin"There is only one way to find out if a man is honest...ask him. If he says yes, you know he is crooked." -- Groucho Marx"Sex isn't the answer. Sex is the question. 'Yes' is the answer" -- Unknown
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement