Skip to main content
Bumped by Community user
lay-out improvement
Source Link
jfpoilpret
  • 9.2k
  • 7
  • 38
  • 54

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*'"*"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. ForFor 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 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);  

errorError: invalid conversion from 'const char*' to 'char*'invalid conversion from 'const char' to 'char' [-fpermissive]fpermissive]**

I am apparently using c_str() wrong?

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?

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?

My C is rusty, so please forgive this simple problem.

This line works:

Tft.drawString("Test",200,200,2,WHITE);Tft.drawString("Test",200,200,2,WHITE);

But, this has compile errors:

String yStr = "Test";
Tft.drawString(yStr,200,200,2,WHITE);

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);

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() functiondrawString() 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;

string stringXY ;
stringXY += xStr;
stringXY += ",";
stringXY += yStr;
Tft.drawString(stringXY.c_str(),200,200,2,RED);  

Tft.drawString(stringXY.c_str(),200,200,2,RED);
errorerror: invalid conversion from 'const char*' to 'char*' [-fpermissive]

I am apparently using c_str()c_str() wrong?

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?

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?

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 405 characters in body
Source Link
user3573562
  • 183
  • 1
  • 11

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

stringXY += xStr; stringXY

stringXY += ","; 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?

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?

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?

added 405 characters in body
Source Link
user3573562
  • 183
  • 1
  • 11
Loading
Source Link
user3573562
  • 183
  • 1
  • 11
Loading