C++ cli 如何转换;PWSTR";至;系统::字符串^";在c++;
我想知道如何将“PWSTR”转换为“System::String^”C++ cli 如何转换;PWSTR";至;系统::字符串^";在c++;,c++-cli,C++ Cli,我想知道如何将“PWSTR”转换为“System::String^” 下面是我的代码片段。。。 数组^nsRecords; 尝试 { nsRecordCount=dns.query(ipAddressString); nsRecords=gcnew数组(nsRecordCount); 对于(int nsRecord=0;nsRecord
下面是我的代码片段。。。
数组^nsRecords;
尝试
{
nsRecordCount=dns.query(ipAddressString);
nsRecords=gcnew数组(nsRecordCount);
对于(int nsRecord=0;nsRecord
我感谢你的帮助
谢谢,
拉马尼应该足够了。顺便说一下,这是一个C++/CLI问题,不是C++ 11。
My code snippet follows here...
array<System::String^>^ nsRecords;
try
{
nsRecordCount = dns.query(ipAddressString);
nsRecords = gcnew array<System::String^>(nsRecordCount);
for(int nsRecord = 0; nsRecord < nsRecordCount; nsRecord++)
{
DNS_PTR_DATA record = dns.getNth(nsRecord);
// below line of code causing error C2440: '=' :
//cannot convert from 'PWSTR' to 'System::String ^'
nsRecords[nsRecord] = record.pNameHost;
}
}