Hi,
If you like to do things directly, you can also use the function defined in
vcclr.h, PtrToStringChars, as that takes a System::Strying and returns a
pointer (wide char, System::Char) to the underlying characters. You can
then perform your own memory management and conversion, if necessary, to
char*. However, if you just need wchar_t* then you can use directly the
returned pointer from PtrToStringChars and there is no overhead at all (you
just have to remember to pin and then release while you are using this).
-Eric
"Jonathan Porter" <Jo************@discussions.microsoft.com> wrote in
message news:B5**********************************@microsof t.com...
Hello All - Hoping someone might be able to point me in the right
direction. I have a System::String that is part of a managed class. Within a member
function, I need to convert this String to a C-Style null terminated
character array so that it can be passed to a legacy C function. Any
ideas? I've tried putting it to a STL string first, but no luck.
Thanks!
Jon