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;
}
 
Back
Top