How to convert array<System::Byte> to char* in C++ CLR?
来源:互联网 发布:淘宝上卖东西的流程 编辑:程序博客网 时间:2024/05/16 07:12
In my project, I pass a byte[] from C# to C++ CLR function.
C++ CLR code:
void TestByteArray(array<System::Byte>^ byteArray){ ...}
C# code:
byte[] bytes = new byte[128];...TestByteArray(bytes);
In the TestByteArray() function, I need convert byteArray to char*, so that I can used it in native C++ code. How can I do such conversion?
Answers
void TestByteArray(array<System::Byte>^ byteArray){ pin_ptr<System::Byte> p = &byteArray[0]; unsigned char* pby = p; char* pch = reinterpret_cast<char*>(pby); // use it...}
转自:http://stackoverflow.com/questions/7707985/how-to-convert-arraysystembyte-to-char-in-c-clr
- How to convert array<System::Byte> to char* in C++ CLR?
- Convert byte array to char* in a clr wrapper
- How to convert char array to String in Java
- How to: Convert System::String to wchar_t* or char*
- convert from to (byte [] array)
- how to convert char to char []
- Java: How to convert int[] to byte[]
- How to convert wchar_t* to char*
- How to convert from int to string in objective c
- How to convert from int to string in objective c
- How to convert InputStream to String/convert char[] to String
- How to define an array in c#.
- How to initialize an array in C
- How to convert Java String into byte[]?
- How to split a string to array in objective-c?
- How can I convert String to Int in C#?
- Insight into DOMDocument - how to convert data from XML to array in PHP
- Convert short to byte[] in Java
- C# 下载功能
- linux下如何把时间转成秒数,或把秒数转换成标准时间格式
- call async method of metro API from non-metro app
- tornado
- 将win7下编译好的nutch移植到linux下运行,出现ExcutionException问题
- How to convert array<System::Byte> to char* in C++ CLR?
- memcache监控
- C#数据库的备份(SQL2005)
- android没有插SD卡/TF卡(TF卡其实就是microSD卡)时的图库(拍照的照片)里图片的保存路径(位置)
- Linux Platform Device and Driver
- JXTA技术与原型实现简介
- Linux下学习DB2命令的笔记
- Java 日期时间 Date类型,long类型,String类型表现形式的转换
- ubuntu下安装NFS