首页 > Windows开发 > 详细

C#调用C接口字符参数编码的问题解决方法

时间:2014-11-13 16:44:56      阅读:370      评论:0      收藏:0      [点我收藏+]

1、传入单字节ANSI字符

[DllImport("hostIO", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]

    public static extern int initHost([MarshalAs(UnmanagedType.LPStr)] string host);


2、传入双字节Unicode字符

[DllImport("hostIO", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
    public static extern int initHost([MarshalAs(UnmanagedType.LPWStr)] string host);

C#调用C接口字符参数编码的问题解决方法

原文:http://blog.csdn.net/wuliao009/article/details/41079179

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!