// char*类型转换为TCHAR*型
static TCHAR* A2U(char* str)
{
int nLen=(int)strlen(str)+1;//待转换字节长度
int nwLen=MultiByteToWideChar(CP_ACP,0,str,nLen,NULL,0); //获得转换后宽字节长度
TCHAR *tstr;
tstr=new TCHAR[nLen];
MultiByteToWideChar(CP_ACP,0,str,nLen,tstr,nwLen); //进行转换
return tstr;
}
// TCHAR*型转换为char*类型
static char* U2A(TCHAR* tstr)
{
char *str;
int nLen=(int)wcslen(tstr)+1; //待转换字节长度
str=new char[nLen];
WideCharToMultiByte(CP_ACP,0,tstr,nLen,str,2*nLen,NULL,NULL); //进行转换
return str;
}