Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to download a file from URL without using curl or libcurl ..in c++.?

How to download a file from URL without using curl or libcurl ..in c++.?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialc++question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mbatra31
    wrote on last edited by
    #1

    Hi, I want to download file from a given URL. I am using URLDownloadToFile() function for this purpose, but I am not getting the actual file. When I try to run the file, it throws an error. As an example, If I download MSVS 2010 service pack 1 from Microsoft's website, the file size will be 795KB. But if I download using URLDownloadToFile() function passing the url and file name, downloaded file size will be 99 KB. Is there any method to download an exe from a URL in C++. Any help wll be appreciated. Regards, mbatra

    J D 2 Replies Last reply
    0
    • M mbatra31

      Hi, I want to download file from a given URL. I am using URLDownloadToFile() function for this purpose, but I am not getting the actual file. When I try to run the file, it throws an error. As an example, If I download MSVS 2010 service pack 1 from Microsoft's website, the file size will be 795KB. But if I download using URLDownloadToFile() function passing the url and file name, downloaded file size will be 99 KB. Is there any method to download an exe from a URL in C++. Any help wll be appreciated. Regards, mbatra

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      Which URL? You must pass the complete URL to the file. When browsing MS for downloads, they are often provided by a confirmation page that will start the download. If you pass that URL, wou will download the web page content. On such pages you will usually find a link to the real file if the download does not start after some time.

      M 1 Reply Last reply
      0
      • M mbatra31

        Hi, I want to download file from a given URL. I am using URLDownloadToFile() function for this purpose, but I am not getting the actual file. When I try to run the file, it throws an error. As an example, If I download MSVS 2010 service pack 1 from Microsoft's website, the file size will be 795KB. But if I download using URLDownloadToFile() function passing the url and file name, downloaded file size will be 99 KB. Is there any method to download an exe from a URL in C++. Any help wll be appreciated. Regards, mbatra

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        mbatra31 wrote:

        I want to download file from a given URL. I am using URLDownloadToFile() function...

        How is it being used?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

        1 Reply Last reply
        0
        • J Jochen Arndt

          Which URL? You must pass the complete URL to the file. When browsing MS for downloads, they are often provided by a confirmation page that will start the download. If you pass that URL, wou will download the web page content. On such pages you will usually find a link to the real file if the download does not start after some time.

          M Offline
          M Offline
          mbatra31
          wrote on last edited by
          #4

          Hi Jochen, Thanks for your response. I got the code working. I was passing the link of the confirmation page, that was the issue. Thanks..!! Regards,

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups