Open hahnicity opened 7 years ago
I modified my library to use itoa, since the number fields on the display will display signed integers - since I actually need to know negative or positive values on my readouts. I suggest modifying the function to channel the data however it works for you.
Sorry to rake up such an old issue, but utoa
(nonstandard) can be implemented with sprintf
/std::sprintf
(standard):
char * utoa(unsigned int value, char * str, int radix)
{
const char * format = nullptr;
switch(radix)
{
case 8:
format = "%o";
break;
case 10:
format = "%u";
break;
case 16:
format = "%x";
break;
}
if(format == nullptr)
return str;
int size = std::sprintf(str, format, value);
return &str[size];
}
We're working on an Intel Edison which uses GNU libc/c++ and we've been trying to compile our nextion code but it doesn't work because
utoa
is not included in the base C/C++ lib. The only workaround I can currently think of is to modify the library to includeutoa
. Do you have any other suggestions?