HI , i need help with a c++ code that downloads a single file from a DIRECT link and save it somewhere on the computer i am working under windows and i have searched google but i didnt find anything simple just tons of codes that i cant understand i dont need any progress of the download or anything just simple file download , Thanks in advanced

But please can you tell me how to use it is there any library to include
because i am new to api so i dont know how to use them in my application , Thanks in advanced

Try this: both first and last parameters can be NULL.

URLDownloadToFile(NULL, "www.DaniWeb.com/something.jpg",
     "c:\\mydir\\something.jpg", NULL);

This code is not sufficient and won't work on some Windows SPx.....

This worked for me on Vista Home using VC++ 2008 Express. But yes, anyone wanting to use that function needs to know what they are doing, such as reading all about it on MSDN and possibly other places.

#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
URLDownloadToFile(NULL, _T("http://www.daniweb.com/certificates/posts46588.jpg"),
     _T("c:\\dvlp\\posts46588.jpg"), NULL, NULL);
	return 0;
}

This worked for me on Vista Home using VC++ 2008 Express. But yes, anyone wanting to use that function needs to know what they are doing, such as reading all about it on MSDN and possibly other places.

#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
URLDownloadToFile(NULL, _T("http://www.daniweb.com/certificates/posts46588.jpg"),
     _T("c:\\dvlp\\posts46588.jpg"), NULL, NULL);
	return 0;
}

It doesnt work for me i am working under windows 7 with Vc Express 2008 Which type of project did u create ?
Thnx for help

This article has been dead for over six months. Start a new discussion instead.