[阅读: 393] 2005-11-07 06:44:15
int CXXXXXX::GetTorrentFromHttp(CString& strURL, char* filename)
{
int nResult = 0;
CInternetSession cis;
CString strTmp, strAll;
CHttpFile* cif = (CHttpFile*)cis.OpenURL(strURL, INTERNET_FLAG_TRANSFER_BINARY);
if(NULL != cif) {
int n = 0;
CArchive ar(cif, CArchive::load);
FILE* pfd = fopen(filename, "wb+");
CString strDebug;
while(1) {
try {
TCHAR ch;
ar >> ch;
fwrite(&ch, sizeof(TCHAR), 1, pfd);
n++;
}
catch(...) {
nResult = -1;
break;
}
}
fclose(pfd);
ar.Close();
delete cif;
}
else
nResult = -1;
return nResult;
}
这段程序在俺机器上跑着没问题,可是一到另一台繁体中文Windows 2003上(在俺机器上编译的debg版)就出问题。只要一运行到上面这段函数的“ar >> ch;”这句,程序就突然关闭了,也不出任何的错误信息。为啥啊?