char* to a string in C#

后端 未结 4 1884
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-14 20:14

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* c = f         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-14 20:24

    Your example isn't completely clear, but your comment suggests you're calling into a c++ dll from c#. You need to return a bstr, not a char * or a string.

    I'd start with this question/answer, which I used when I had to perform this operation:

    How to return text from Native (C++) code

提交回复
热议问题