转换字符串^在C在C#中的CString ++ / CLI [英] Convert String^ in c# to CString in c++/CLI
问题描述
我需要在一个问题上的帮助,我停留在编码的 MFC
。
I need a help on one question where I stuck while coding my app in MFC
.
我使用 CLR
即公共语言运行库
在我的应用程序集成C#的API。
但现在我卡在转换系统::字符串^
到的CString
。
我不能做到这一点。
I am using CLR
i.e Common Language Runtime
in my application to integrate c# APIs.
but now I stuck on converting System::String^
to CString
.
I am not able to do that.
我使用下面code。
String^ csPass = gcnew String(strPassword.GetBuffer());
array<Byte>^ Value = Encoding::UTF8->GetBytes(csPass);
for (int i = 0; i < Value->Length; i++ )
{
csPass += String::Format( "{0:X2}", Value[ i ] );
}
现在我想转换 csPass
到的CString
。
任何一个可以帮助我在此。
谢谢你在前进。
now I want to convert csPass
to CString
.
Can any one help me on this.
Thank you in advance.
推荐答案
考虑阅读这个MSDN线程有关字符串转换。此外,下面的讨论可能对您有用:
Consider reading this MSDN thread about string conversions. Also, following discussions may be useful for you:
- 的CString转换到std :: wstring的
- <一个href="http://stackoverflow.com/questions/5493017/problem-how-to-convert-cstring-into-const-char-in-c-mfc">Problem:如何转换成CString的为const char *在C ++ MFC
- 在C转换字符串的CString ++
- 的CString到LPCTSTR转换
- 的CString转化成char
- 如何转换_bstr_t到CString的
- Convert CString to std::wstring
- Problem: How to convert CString into const char * in C++ MFC
- Converting String to Cstring in c++
- CString to LPCTSTR conversion
- Conversion of CString to char
- How to convert _bstr_t to CString
使用这种材料,你可以找出如何做到这一点,甚至上传自己的解决方案作为一个答案
With this material you can find out how to do it and even post own solution as an answer
这篇关于转换字符串^在C在C#中的CString ++ / CLI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!