About int and char thing

Hi all.
The TFT_eSPI.h has: drawString(const char *string, int32_t x, int32_t y, uint8_t font), // Draw string using specified font number
and I have int count = 0; how to drawString my count instead of string?

count is any natural number.

like: drawString(count, int32_t x, int32_t y, uint8_t font), ?
Thanks
Adam

Great!
It works!
Thank you Delta_G.

did you mean snprintf() ?

I find strtol() (and its siblings) to be more adequate (and uses up less flash) when you have only one number to read.

oops sorry - coffee time ! indeed you want to go from int to ascii.

that being said, itoa() is part of the standard lib but not ANSI-C and is not part of C++. the arduino environment and our compiler supports it.

yes as they say in the doc

This function is not defined in ANSI-C and is not part of C++, but is supported by some compilers.

and so they recommend sprintf() as the portable option (but this comes with consequences I think on the code size on our small MCUs)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.