关于在UNIcode环境下得TCHAR转string类型以及string转TCHAR

using namespace System::Text;

String ^TCHARtoStr(TCHAR *temp) //TCHAR转String
{
array<unsigned char> ^lname=gcnew array<unsigned char>(128);
String ^lName;
Marshal::Copy(IntPtr(temp),lname,0,lname->Length);
int ii;
for(ii=0;ii<lname->Length;ii++)
if(lname[ii]=='\0')
break;
lName=Encoding::Default->GetString(lname,0,ii);
delete lname;
return lName;
}

TCHAR* strName=(TCHAR*)(void*)Marshal::StringToHGlobalUni(Convert::ToString(this->textBox2->Text));

上一篇:Spring3 MVC 类型转换


下一篇:Kali linux 2016.2(Rolling)中的Exploits模块详解