chipKIT® Development Platform

Inspired by Arduino™

dtostrf() isn't in stdlib ?

Created Mon, 02 Sep 2013 02:58:03 +0000 by unexpectedly


Mon, 02 Sep 2013 02:58:03 +0000

It wasn't declared, so I went and found what the Arduino people did for it...

//  from
char *dtostrf (double val, signed char width, unsigned char prec, char *sout) {
  char fmt[20];
  sprintf(fmt, "%%%d.%df", width, prec);
  sprintf(sout, fmt, val);
  return sout;

I'll get back if/when I find out it doesn't work. At least it compiled...


Mon, 02 Sep 2013 05:04:05 +0000

Hmmmm, some kind of include problem. Now it's yelling at me because it is defined twice.

So I put it inside the c++ class of the function that needed it. Cheesey hack. Haven't been able to test the functionality yet.