I\'m calling a function from a native DLL which returns a char* pointer, how can I convert the returned pointer to a string ? I tried :
char*
char* c = f
Update your P/Invoke declaration of your external function as such:
[DllImport ( "MyDll.dll", CharSet = CharSet.Ansi, EntryPoint = "Func" )] [return : MarshalAs( UnmanagedType.LPStr )] string Func ( ... );
This way you won't have to do extra work after you get the pointer.