如何将String ^转换为字符数组 [英] how to convert String ^ to character array

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

问题描述

我想将textbox的值放入char数组中,所以请实际帮助我textbox-> text将返回字符串^,以便如何将其转换为char数组

在此先感谢您

i want to take the textbox value into char array so please help me out actually textbox->text will return string^ so how to convert it into char array

Thanks in advance

推荐答案

您可以使用Marshal类的aspx"target =" _ blank"title =" New Window> ^ ]方法.请参见此方法的文档中的示例,它确实完全进行了这种转换.

另外,CString类提供了一个构造函数,该构造函数采用类型为System::String^的参数. :)

问候
You can make such a conversion using StringToHGlobalAnsi()[^] method of the Marshal class. See the example from the documentation of this method, it does exactly such conversion.

Alternatively CString class provides a constructor which takes argument of type System::String^. :)

Regards


PtrToStringChars会做到这一点.


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

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