[SOLVED] String to char *, and get length of char*

Hello everybody,

I have Arduino DUE, connected to VGA, witch draws text to screen,
(I’m using dueVGA library)

So I need to draw integers, but “drawText” function only accepts char *,
I need somehow convert int to char *, or using String(123, DEC) convert String to char *.

And it would be great that somebody would tell me how to get length of char * :slight_smile:

EDIT:
Use strlen() to get length, and String.c_str() to convert to char *.

Did you try reading the documentation for the String class?

AWOL: Did you try reading the documentation for the String class?

Yeah, I did. I used .toCharArray(), but it didn't worked out, I'm not sure why. Maybe it's my code problem...

Sorry, it was my code problem. It's solved. I'm using c_str() and it works. strlen() works perfectly.

I need somehow convert int to char *

That is what the itoa() function is for. Pissing away resources using the String class to do it is like swatting flies with a sledgehammer.