"keith" <ke***@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
In managed C++, there is variable String *s. The variable got value from a
C# assembly. Then I need to convert it into char *c in order to call
an external function in a dll that accepts parameter func(char c[]).
How to convert from String *s to char *c?
This gets you a pointer to the (wide) characters that comprise the string:
#include <vcclr.h>
wchar_t __pin *pStr = PtrToStringChars(s);
At that point you'll need to convert to ANSI. Check the docs for conversion
functions such as wcstombs() or WideCharToMultiByte().
Regards,
Will