16,473
社区成员
发帖
与我相关
我的任务
分享
CFtpFileFind finder(m_pFtpConnection);
CString strFileName = _T("");
strFileName = finder.GetFileName();
USES_CONVERSION;
char* pFileName = T2A(strFileName);
CharArrayToCString(pFileName, strFileName,CP_UTF8);
void CSelFtpDirDlg::CharArrayToCString(const char* pChar, CString& str, int encodeType)
{
if(pChar != NULL)
{
size_t len = strlen(pChar);
size_t wcharCount =(size_t)MultiByteToWideChar(encodeType, 0, (const char *)pChar, len, NULL, 0);
USES_CONVERSION;
WCHAR* szTemp = new WCHAR[wcharCount + 1];
szTemp[wcharCount] = 0;
MultiByteToWideChar(encodeType, 0, (const char *)pChar, (int)len, szTemp, (int)wcharCount);
char* pmtStr = W2A(szTemp);
str = (CString)pmtStr;
str = str.Left( len);
delete []szTemp;
}
}