G
Guest
Hi,
I am sending strings from C# to a third party unmanaged code written in C.
Signature of one of the methods in the unmanaged code is
SomeMethod(char *name, char *value)
Currently, I am converting the string in to byte array and passing the
byte[] to
this method. My current code is,
string str = "Some-Name";
byte[] n = UTF8Encoding.GetBytes(str);
str = "Some-Value";
byte[] v = UTF8Encoding.GetBytes(str);
SomeMethod(n,v);
My current, DLLImport method decleration is:
SomeMethod(byte[] name, byte[] val);
Method Signature in unmanaged code is :
SomeMethod(char *name, char *val);
Is my procedure correct. Is there any better way for sending strings to a
method
in unmanaged code writtent in C that expects pointers to strings ?
Kindly let me know. I'm using C#, Compact Framework.
Cheers,
Naveen.
I am sending strings from C# to a third party unmanaged code written in C.
Signature of one of the methods in the unmanaged code is
SomeMethod(char *name, char *value)
Currently, I am converting the string in to byte array and passing the
byte[] to
this method. My current code is,
string str = "Some-Name";
byte[] n = UTF8Encoding.GetBytes(str);
str = "Some-Value";
byte[] v = UTF8Encoding.GetBytes(str);
SomeMethod(n,v);
My current, DLLImport method decleration is:
SomeMethod(byte[] name, byte[] val);
Method Signature in unmanaged code is :
SomeMethod(char *name, char *val);
Is my procedure correct. Is there any better way for sending strings to a
method
in unmanaged code writtent in C that expects pointers to strings ?
Kindly let me know. I'm using C#, Compact Framework.
Cheers,
Naveen.