D
devgrt
I have an eVC DLL that I call from C#. I want to pass a C# string to the dll
and then copy that string's data into a char buffer as shown below.
I tried a different method (from my last post) but something is still
wrong -- I only get two random characters instead of the whole string...
eVC DLL:
int fn1(char *s)
{
char *data = new char[40];
strcpy(data, s);
//data is not correct at this point
}
C# calling the DLL:
[DllImport("MyCProcess.dll")]
public static extern int fn1(byte [] s);
byte [] s = System.Text.Encoding.Unicode.GetBytes("this is a test string");
int r = fnl(s);
Thank for any help!
and then copy that string's data into a char buffer as shown below.
I tried a different method (from my last post) but something is still
wrong -- I only get two random characters instead of the whole string...
eVC DLL:
int fn1(char *s)
{
char *data = new char[40];
strcpy(data, s);
//data is not correct at this point
}
C# calling the DLL:
[DllImport("MyCProcess.dll")]
public static extern int fn1(byte [] s);
byte [] s = System.Text.Encoding.Unicode.GetBytes("this is a test string");
int r = fnl(s);
Thank for any help!