المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Download file from internet



C++ Programming
08-16-2011, 03:42 AM
I have a strange problem : I succesfully download a file from a server with follow code :
BOOL CUpdateThread::DownloadFile(CString sAddress, CStringArray& saResult){ CString sTemp; BOOL bRet = FALSE; CInternetSession ISession; CInternetFile* pIFile = NULL; try { pIFile = (CInternetFile*)ISession.OpenURL(sAddress); while(pIFile->ReadString(sTemp))saResult.Add(sTemp); bRet = TRUE; } catch(CInternetException* pInternetException) { pInternetException->GetErrorMessage(m_pMessage->GetBuffer(255),255); m_pMessage->ReleaseBuffer(); pInternetException->Delete(); } catch(CException* pException) { pException->GetErrorMessage(m_pMessage->GetBuffer(255),255); m_pMessage->ReleaseBuffer(); pException->Delete(); } if(pIFile) { pIFile->Close(); delete pIFile; } ISession.Close(); return bRet;}let say that with this code, I download from an server a text file, test.txt ( a list of words, nothing special ). I change the content of the text file to server, I download again the same text file, test.txt, but content is the same( doesn't have changes ). I stop the application, start again, and if I download again the text file, test.txt, the contain is now changed ... why ?