String* to char[]

  • Thread starter Thread starter Peteroid
  • Start date Start date
char *GCStringToChar(String __gc *str)
{
if (str == NULL)
{
return NULL;
}

const wchar_t __pin* p = PtrToStringChars(str);
char* result = (char *)malloc((str -> Length + 1) * 2);
wcstombs(result, p, (str -> Length + 1) * 2);

return result;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top