Tag: c strings

在c ++ / CLI中将c#中的String ^转换为CString

在MFC编写应用程序时,我需要帮助解决一个问题。 我在我的应用程序中使用CLR即Common Language Runtime来集成c#API。 但现在我坚持将System::String^转换为CString 。 我无法做到这一点。 我正在使用以下代码。 String^ csPass = gcnew String(strPassword.GetBuffer()); array^ Value = Encoding::UTF8->GetBytes(csPass); for (int i = 0; i Length; i++ ) { csPass += String::Format( “{0:X2}”, Value[ i ] ); } 现在我想将csPass转换为CString 。 谁可以帮我这个事。 先感谢您。