|
|
Comments and Discussions
|
|
 |

|
dear otom
when using CFTPClient::DownloadFile,I set strLocalFile value with chinese word, such as _T("D:\\下载文件夹\\down.txt").
the ConvertToString(strFileName).c_str() in
m_pFile = fopen(CCnv::ConvertToString(strFileName).c_str(),
CCnv::ConvertToString(strMode).c_str()); get wrong. not “D:\\下载文件夹\\down.txt”.
i change the code in definements.h, then it goes right
static std::string& ConvertToString(const tstring& strIn, std::string& strOut)
{
#ifdef _UNICODE
if( strIn.size() == 0 )
{
strOut.clear();
}
else
{
setlocale(LC_ALL, ".936");
int nSizeRequired = wcstombs(NULL, strIn.c_str(), 0);
strOut.resize(nSizeRequired);
wcstombs(&*strOut.begin(), strIn.c_str(), nSizeRequired);
//strOut.resize(strIn.size());
//wcstombs(&*strOut.begin(), strIn.c_str(), strOut.size());
}
#else
strOut = strIn;
#endif
return strOut;
}
but i think the better way to fix this problem, i should fix CFile, make it support unicode,such as using
_tfopen instead of fopen. Maybe you have a better way, please tell me
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
A non-MFC class to encapsulate the FTP protocol.
| Type | Article |
| Licence | CPOL |
| First Posted | 27 Oct 2004 |
| Views | 268,153 |
| Downloads | 22,609 |
| Bookmarked | 181 times |
|
|