String to char array

Hi,

I have a String like this

String stringone = "2d2a";

I could I convert it to a char array, such like

char melody[] = "2d2a";

I did something like
char melody[] = stringone.getchars();

but it has errors "class String has no member named 'getchars'"

what is the best solution to convert string to char array?

char melody[] = { "2d2a" };    // But it will be zero terminated as 2d2a00

I mean I have the String s, and I want to initialize a char array from s, how could I do that?

lloyddean:

char melody[] = { "2d2a" };    // But it will be zero terminated as 2d2a00

I mean I have the String s, and I want to initialize a char array from s, how could I do that?

Have you bothered to look at the String documentation?

Specifically, perhaps, the toCharArray() method?

Then, ditch the String class altogether. It can corrupt your program when the destructor calls free().