2010-11-29 68 views
0
I am appending one CString value with integer but getting error as "Cannot Convert const char* to int . 
int iFolderType = 0; 
CString strCurrFolder = ""; 
        HShareFolder = m_pTreeview->InsertItem(strCurrFolder,hChildItem);     
        m_pTreeview->SetItemImage(HShareFolder,2,2); 

       if(bCheck == false) 
       { 
        iFolderType = eBOTH; 

       } 
       else 
       { 
        iFolderType = eCIFS; 
       } 

       strCurrFolder.Append("|"); 
       strCurrFolder.Append(iFolderType); //This line gives error 
       m_strFolderTypeList.AddHead(strCurrFolder); 

回答

0

您必須將其轉換爲CString或const char *。最簡單的方法是使用CString ::格式

CString strFolderType; 
strFolderType.Format(_T("%d"), iFolderType); 
strCurrFolder += strFolderType; 
相關問題