开发者

Cannot Convert const char* to int in MFC(VC++)?

开发者 https://www.devze.com 2023-01-27 14:40 出处:网络
I am appending one CString value with integer but getting error as \"Cannot Convert const char* to int .
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("|开发者_JAVA技巧");
                strCurrFolder.Append(iFolderType); //This line gives error
                m_strFolderTypeList.AddHead(strCurrFolder);  


You'll have to convert it to CString or const char*. The easiest way is using CString::Format

CString strFolderType;
strFolderType.Format(_T("%d"), iFolderType);
strCurrFolder += strFolderType;
0

精彩评论

暂无评论...
验证码 换一张
取 消