Is it possible to get a char* for a string variable in C#?
I need to convert a path string to a char* for using some native win32 function ...
Is it possible to get a char* for a string variable in C#?
I need to convert a path string to a char* for using some native win32 function ...
Like some other posts pointed out, fixed (char* p = str) is not really compatible with native format and StringBuilder does not really work either. This is what worked for me:
fixed (byte* p = Encoding.ASCII.GetBytes(str))
{
native_call((char*)p);
}