May I know where is the complete source code pleasee ?
ReplyOriginally posted by: Baek Seung Ki
code is short but very useful.
thank you.
Originally posted by: zhanglixin
http://www.ietf.org/rfc/rfc2326.txt
here you can find theinformaiton of rtsp controls
let us share it..
Originally posted by: monir
It returns String but if the file in the internet was in binary mode, what will be happen then? plese give me some solution for image file like jpg,gif etc.
Thanks.
-Monir
Monir@tigerit.com
Originally posted by: Bob
The problem with this function is that even if the file doesnt exist, it still creates a file on my computer with some data in it.
Is there anyway to know if the file exists before dowloading?
thanks
ReplyOriginally posted by: Jay Beckert
Very good easy code that does the job it needs to do.
Just a simple fix though. Add this after the file is
wrote to disk.
remotefile->Close();
mysession.Close();
So the whole code looks as follows:
CString GetFile(const char *url, const char *filename)
{
#define HTTPBUFLEN 512 // Size of HTTP Buffer...
char httpbuff[HTTPBUFLEN];
TCHAR szCause[255];
CString Cause;
Cause.Format("YES");
TRY
{
CInternetSession mysession;
CStdioFile *remotefile = mysession.OpenURL(url,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
CFile myfile(filename, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
int numbytes;
while (numbytes = remotefile->Read(httpbuff, HTTPBUFLEN))
myfile.Write(httpbuff, numbytes);
remotefile->Close();
mysession.Close();
}
CATCH_ALL(error)
{
error->GetErrorMessage(szCause,254,NULL);
Cause.Format("%s",szCause);
}
END_CATCH_ALL;
return (Cause);
}
Originally posted by: Anthony
How can I download file(s) from servers which need a password? Where should be login and password data implemented?
Thank you.
Originally posted by: Jethro Kangleon
Thanks a lot for the code!
ReplyOriginally posted by: Ryan Allan
This works great and all on 32-bit environments. Does anyone have a simple solution for a file download in a 16-bit environment?
ReplyOriginally posted by: Sasikala.V.B.
How can i get the status of a file transfer
(whether it is transfered or not)?