posts - 13,comments - 0,trackbacks - 0

           

          BOOL Download( CString szURL, CString szDstFile )
          {
          	BOOL res = false;
          	CInternetSession Session;
          	CHttpFile *pHttpFile = NULL;
          
          	try{
          		pHttpFile = (CHttpFile*)Session.OpenURL(szURL);
          	}catch(CInternetException * m_pException){
          		pHttpFile = NULL;
          		m_pException->m_dwError;
          		m_pException->Delete();
          		Session.Close();
          		res = false;
          	}
          
          	CString strLine;
          	CFile xmlFile;
          	BOOL bResult = xmlFile.Open(szDstFile, CFile::modeCreate | CFile::modeWrite);
          	if(pHttpFile != NULL && bResult)
          	{
          		while(pHttpFile->ReadString(strLine) != NULL)
          		{
          			xmlFile.Write(strLine, strLine.GetLength());
          		}
          		xmlFile.Close();
          		res = true;
          	}
          	else
          	{
          		res = false;
          	}
          
          	Session.Close();
          	pHttpFile->Close();
          	delete pHttpFile;
          	pHttpFile = NULL;
          	
          	return res;
          }
           
          posted on 2011-08-31 16:35 CrackRen 閱讀(142) 評論(0)  編輯  收藏 所屬分類: VC

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 泸定县| 永安市| 绍兴县| 保山市| 建宁县| 大理市| 郸城县| 罗定市| 黔西县| 琼海市| 锡林郭勒盟| 屯昌县| 石屏县| 宜君县| 资源县| 电白县| 镇康县| 阳西县| 浏阳市| 黑河市| 股票| 蒲城县| 达州市| 常德市| 新安县| 黄骅市| 正安县| 图们市| 天祝| 城口县| 通州区| 茌平县| 荃湾区| 象山县| 揭东县| 兴业县| 青神县| 达孜县| 丁青县| 绵竹市| 万州区|