Reputation: 113
I have a C++ library that I use in my C# application. One of the methods in the C++ library returns a char *
. How can I convert that char *
into a string in my C# application?
Apparently in my C# application, the data type returned in this method is of type sbyte *
.
Upvotes: 2
Views: 679
Reputation: 292385
String
has a constructor that takes a char*
:
char* x = ...
string s = new string(x);
And another one that takes a sbyte*
:
sbyte* x = ...
string s = new string(x);
Upvotes: 4