String ^TapePath;
System::IntPtr ptr = System::Runtime::
InteropServices::Marshal::StringToHGlobalUni(TapePath);
LPWSTR lpwStr = static_cast<LPWSTR>(ptr.ToPointer());
本文介绍如何在C#中将字符串转换为宽字符指针,并提供了具体的代码实现。通过使用System.IntPtr 和 System.Runtime.InteropServices 命名空间中的 Marshal 类来完成这一过程。
String ^TapePath;
System::IntPtr ptr = System::Runtime::
InteropServices::Marshal::StringToHGlobalUni(TapePath);
LPWSTR lpwStr = static_cast<LPWSTR>(ptr.ToPointer());
177

被折叠的 条评论
为什么被折叠?