[問題] MFC視窗程式使用CMarkup讀XML檔,字串轉 …
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++
問題(Question):
問題:
MFC視窗程式使用CMarkup讀取XML檔
因為字串格式不同,無法顯示在edit control方塊上
主要程式碼(Code):
CMarkup xml2;
xml2.Load(MCD_T("C:\\Documents and Settings\\Lo\\My Documents\\Visual Studio
2008\\Projects\\Read XML 2\\UserInfo.xml"));
if(xml2.FindChildElem(MCD_T("STUDENT")))
{
xml2.IntoElem();
xml2.FindChildElem(MCD_T("SN"));
CString csSN = xml2.GetChildData();
xml2.FindChildElem(MCD_T("NAME"));
CSstring csNAME = xml2.GetChildData();
xml2.FindChildElem(MCD_T("MAIL"));
CString csMAIL = xml2.GetChildData();
xml2.OutOfElem();
m_SN.SetWindowText(csSN);
m_NAME.SetWindowText(csNAME);
m_MAIL.SetWindowText(csMAIL);
}
------------------------
error C2440: '正在初始化' : 無法由 'std::wstring' 轉換為
'ATL::CStringT<BaseType,StringTraits>'
> with
> [
> BaseType=wchar_t,
> StringTraits=StrTraitMFC_DLL<wchar_t>
> ]
> 沒有可以取得來源型別的建構函式,或建構函式多載解析模稜兩可
------------------------
請問板友知道如何將'std::wstring' 轉換為'CString'嗎?
這個問題讓我卡好久 > <
感恩!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.123.224.64
※ 編輯: lo11212001 來自: 140.123.224.64 (08/02 21:42)
※ 編輯: lo11212001 來自: 140.123.224.64 (08/02 21:45)
※ 編輯: lo11212001 來自: 140.123.224.64 (08/02 21:48)
※ 編輯: lo11212001 來自: 140.123.224.64 (08/02 21:53)
推
08/02 21:57, , 1F
08/02 21:57, 1F
→
08/02 22:39, , 2F
08/02 22:39, 2F
→
08/02 22:40, , 3F
08/02 22:40, 3F
→
08/02 23:10, , 4F
08/02 23:10, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章