Using stdlib in web IDE?

Hi,

Is it posible to use stdlib.h in projects?

I receive error:
error: ‘dtostrf’ was not declared in this scope

Looks like it’s already included, just add this line to the top of your code:

extern char *dtostrf (double val, signed char width, unsigned char prec, char *sout);

2 Likes

BTW @Dave do you think this should be required to have to use extern or should it just work?

Hmm…

There is an implementation of dtostrf there, but it looks like it wasn’t exposed. I think it is possible to add an #include <stdlib.h> to your application, but it might not have everything.

In this case as well I think you can use the more ‘arduino-y’:

explicit String(double, int decimalPlaces=6);

Which would look something like:

double foo = 3.14159;
String piStr = String(foo);

Thanks!
David