Desperately need your help. A weird problem about CString
-
First, UNICODE has been defined in my program. Second, my CString involves Chinese characters as well as English letters. the following piece of code runs correctly and the format of the resulted file "myTxt.txt" is
Unicode
CFile file(_T("myTxt.txt"), CFile::modeCreate|CFile::modeWrite);
CArchive ar(&file, CArchive::store, 512);
CString str;
str = _T("Welcome 张三");
TRACE(str); //no error
ar.WriteString(str);however, the following piece of code dose not run correctly and the format of the resulted file "myTxt.txt" is
ANSI
CFile file(_T("myTxt.txt"), CFile::modeCreate|CFile::modeWrite);
CArchive ar(&file, CArchive::store, 512);
CString str;
str = m_ListCtrl.getItemText(0,0);
TRACE(str); //no error
ar.WriteString(str);isn't it weird? anybody has any idea?
Thank you very much!!! ------------------- I am learning C++ and English
-
First, UNICODE has been defined in my program. Second, my CString involves Chinese characters as well as English letters. the following piece of code runs correctly and the format of the resulted file "myTxt.txt" is
Unicode
CFile file(_T("myTxt.txt"), CFile::modeCreate|CFile::modeWrite);
CArchive ar(&file, CArchive::store, 512);
CString str;
str = _T("Welcome 张三");
TRACE(str); //no error
ar.WriteString(str);however, the following piece of code dose not run correctly and the format of the resulted file "myTxt.txt" is
ANSI
CFile file(_T("myTxt.txt"), CFile::modeCreate|CFile::modeWrite);
CArchive ar(&file, CArchive::store, 512);
CString str;
str = m_ListCtrl.getItemText(0,0);
TRACE(str); //no error
ar.WriteString(str);isn't it weird? anybody has any idea?
Thank you very much!!! ------------------- I am learning C++ and English
You dont need to delete your message you can modify your message. See Easy text document conversion - ANSI/Unicode and Unicode/ANSI[^]
_**
**_
WhiteSky
-
You dont need to delete your message you can modify your message. See Easy text document conversion - ANSI/Unicode and Unicode/ANSI[^]
_**
**_
WhiteSky