您的位置:首页 > 编程语言 > C#

C# 调用C写的DLL时 对应的char* 类型转化为 ref byte

2012-08-07 10:59 387 查看
C中代码:

void read( char *filename )
{
.......
}

C#中代码:
[DllImport("myC.dll", EntryPoint = "read", CharSet = CharSet.Auto)]
public static extern void read(ref byte filename);调用示例:
string name = @"d:\result\Gaussian_6_0.3.jpg";
byte[] filename = new byte[100];
for (int i = 0; i < name.Length; i++)
{
filename[i] = (byte)name[i];
}
liblept168.read(ref filename[0]);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  byte c# dll c string