Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1220
  • Last Modified:

C++ Download Web page

I have had to make a switch from Visual Basic to C++. I need to make a console application (so no MFC) to download a webpage (just its contents works, too) and save it to a file on the hard drive. I am using Visual Studio 2008 and cannot find an answer via the MSDN.
0
ddbrown123
Asked:
ddbrown123
  • 2
1 Solution
 
Infinity08Commented:
Take a look at libcurl, a free library for everything HTTP (and more) :

        http://curl.haxx.se/libcurl/

and more specifically this example :

        http://curl.haxx.se/lxr/source/docs/examples/simple.c
0
 
evilrixSenior Software Engineer (Avast)Commented:
The WinInet library, which is part of the Windows SDK (and part of the OS) contains all the functions you need to download a web page.

InternetOpen()
Initializes an application's use of the WinINet functions.
http://msdn.microsoft.com/en-us/library/aa385096(VS.85).aspx

InternetOpenUrl()
Opens a resource specified by a complete FTP, Gopher, or HTTP URL.
http://msdn.microsoft.com/en-us/library/aa385098(VS.85).aspx

InternetReadFile()
Reads data from a handle opened by the InternetOpenUrl
http://msdn.microsoft.com/en-us/library/aa385103(VS.85).aspx

InternetCloseHandle()
Closes a single Internet handle
http://msdn.microsoft.com/en-us/library/aa384350(VS.85).aspx
0
 
evilrixSenior Software Engineer (Avast)Commented:
>> I need to make a console application (so no MFC) to download
You can write console applications using MFC. The Microsoft Foundation Classes aren't just about writing GUI applications.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now