1,char* to LPTSTR
LPTSTR Char2LPTSTR(char* mchar)
{
int length ;
wchar_t* pWChar;
length = MultiByteToWideChar (CP_OEMCP, 0, mchar, -1, NULL, 0) ;
if(length<=0)return NULL;
pWChar=new wchar_t[length+1];
memset(pWChar,0,length+1);
MultiByteToWideChar (CP_OEMCP, 0, mchar, -1, pWChar, length+1) ;
return pWChar;
}
注意用完后要及时
delete [] pWChar;
2, CString to char*
char* pmodel=(LPSTR)(LPCTSTR)csSelectedModel;
char* to LPTSTR,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/tiancun/p/3812694.html