String to LPSTR

How do I convert a JUCE String to an LPString for CreateProcess?

i just figured out that (char *)(const char *)yourString works, but i really have no idea why… :?

that’s cheating really, because casting a String to a non-const char* is a Very Bad Idea.

When you cast a String to a const char*, the pointer is only valid until the String is altered, and it may also be shared between other Strings, as they’re reference counted. If you use that pointer as a non-const string you’re asking for trouble…