如何将unsigned char数组转换为String ^ [英] how to convert unsigned char array to String^

查看:401
本文介绍了如何将unsigned char数组转换为String ^的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我已经阅读了很多文章,但仍在寻找我的问题的答案。我写了一个c ++包装类,它有一个这样的函数:



  void  ManagedWrapper :: ReadFile( String  ^ licFile)
{
ReaderClass reader;
unsigned char readFile [ 5000 ];
reader.readLicFile(readFile);
// readFile变量包含全文
}





我想将readFile文本分配给参数String ^ licFile,这样函数的调用者就会得到更新的文本。



我应该如何将Unsigned Char数组转换为托管字符串?



谢谢。

解决方案

< blockquote>其中一个将为你工作...

https://msdn.microsoft.com/en-us/library/ttyxaek9(v = vs.110).aspx [ ^ ]

https://msdn.microsoft.com/en-us/library/744y86tc(v = vs.110 ).aspx [ ^ ]

Hello,
I have gone through many article but still looking for answer of my question. I have written c++ wrapper class which has one function like this:

void ManagedWrapper::ReadFile(String^ licFile)
{
    ReaderClass reader;
	unsigned char readFile[5000];
	reader.readLicFile(readFile);
    //readFile variable contains whole text 
}



I want to assign readFile text to parameter "String^ licFile" so caller of the function will get updated text.

How should I convert Unsigned Char array to Managed String?

Thanks.

解决方案

One of these will do the work for you...
https://msdn.microsoft.com/en-us/library/ttyxaek9(v=vs.110).aspx[^]
https://msdn.microsoft.com/en-us/library/744y86tc(v=vs.110).aspx[^]


这篇关于如何将unsigned char数组转换为String ^的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆