Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 2 months ago.
What is the best way of converting a float number to an ASCII string?
What is the best way of converting a float number to an ASCII string?
1 Answer
11 years, 2 months ago.
Probably easiest to just use sprintf:
float value = 1.24; char buffer[10]; sprintf(buffer, "%f", value);
You can also add precission modifiers the usual way: http://www.cplusplus.com/reference/cstdio/printf/