My C is rusty, so please forgive this simple problem.
This line works:
Tft.drawString("Test",200,200,2,WHITE);
But, this has compile errors:
String yStr = "Test";
Tft.drawString(yStr,200,200,2,WHITE);
The function in the library:
void drawString(char *string,unsigned int poX, unsigned int poY,unsigned int size,unsigned int fgcolor);
The error is "no known conversion for argument 1 from 'String' to 'char*'".
Conclusion - I need a character array. Here's what I am trying to accomplish.
I have two integers that I would like to display on my Tft screen. For example, 225 and 250 to be displayed as "225,250".
I haven't figured out a way to build the char array for the drawString()
function.
Assistance would be appreciated.
Thanks for the quick reply Ignacio.
I tried that, but the compiler still doesn't like it.
Here's how I built the string:
string stringXY ;
stringXY += xStr;
stringXY += ",";
stringXY += yStr;
Tft.drawString(stringXY.c_str(),200,200,2,RED);
Error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
I am apparently using c_str()
wrong?