Go Down

Topic: Convert String string1 to char* (Read 17 times) previous topic - next topic

sholland

Actually modifying the WString.h works more like how I want it to

Thanks again for this information. It's really helped.

Chet

I modified my WString.h and WString.cpp files to make toCharArray match the documentation.  Does anyone see a potential problem with this?

WString.h
Code: [Select]
char* toCharArray();

WString.cpp
Code: [Select]
char* String::toCharArray()
{
     return _buffer;
}

PaulS

Whatever you hand that pointer back to can modify the string. The initial toCharArray() makes a copy of the String contents.

Go Up