我需要将 LPTSTR 转换为 String^ 才能通过 MessageBox 查看它;
LPTSTR szResult;
DWORD language = GetPrivateProfileString(L"LANGUAGE", L"LANGUAGE", L"", szResult, 255, L"\\file.ini");
System::String^ str_buffed = msclr::interop::marshal_as<System::String^>(szResult);
MessageBox::Show("CLR MessageBox", str_buffed, MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
我做得很好吗?因为我遇到了异常: System.AccessViolationException - Attempting to read the protected memory
如何以其他方式读取 ini 文件并将其转换(返回)为 String^ ?