How do one convert double to string on c99? (embedded C)

Rookie91

I am collecting the digital values(integers) and doing a computation, which is of double type. I tried displaying the values using sprintf() and it is only displaying the integers correctly as neither float nor double is being converted to string.

Is there any function from library that can be of use here to convert double -> string?

str is a character array and tempC is a double

   sprintf(str,"%4f",tempC );
    LCD_Position(1,0);
    LCD_PrintString(str);

Note:dtostrf() is not available in the system And both sprintf and snprintf, did not work.

0___________

To use printf family functions on embedded targets you need to tell the compiler that you are happy to sacrifice plenty of FLASH memory to support it.

  1. For AVR: MPLAB and GCC (probably - I do not use AVR uCs for many years) -Wl,-u,vfprintf -lprintf_flt -lm
  2. For ARM: -specs=nano.specs -lc -u _printf_float

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to convert float64 to c99 hex string in Golang?

How do I convert a double into a string in C++?

How do I convert a pointer to double in C?

How did C99 do type generic macros without _Generic (C11)?

how do you split a string embedded in a delimiter in C++?

How to use make and compile as C99?

How to use rand -- C99 version

How to get the timezone in C99?

How to convert the double value to string without losing the data in c#

C# how to convert a double to string with exponential notation

How could I convert a string variable to a double in C#

C# how to convert a double to string with decimal and thousand

how to convert a string number with leading 0 to a double in c#

How do I safely convert a double into an integer in C++?

How do you convert a Python Decimal instance to a C++ double?

How do I convert a string containing one number into a vector in C++ where all the digits are the elements of vector

How do I use C99 complex numbers with clang on Windows?

How to convert char to double in C?

How to convert to a double in c#

Convert from textbox string to double in C#

C# Convert Double to a string from a DataGridView

Convert double and vertex handle into a string in c++

Convert string to double or float c#

Trying to convert string into double C#?

Convert Double to String (The complete number) C#

C++ convert string to double with precision

C++: Convert string to a vector<double>

How to convert fractional part of double to string or fractional part of double to integer using c without changing exact value

Can one set std=c99 in GCC as a default?