Downloading File from Web

Can someone please show me an example of the correct syntax of using only c++ code for downloading a file from the web without having to use the curl language? Thanks for your help.
If you're using windows, you can use the InternetReadFile functions.

There is example code here: http://stackoverflow.com/questions/6960084/downloading-binary-files-with-wininet

It's a bit more complicated than libcurl, but that's the price for using an OS API directly.
In windows most "simple" way is to use UrlDownloadToFile(). I personally recommend using libCurl even on windows.
http://msdn.microsoft.com/en-us/library/ms775123(v=vs.85).aspx
I personally recommend using libCurl even on windows.


I recommend it especially on windows :p
Sorry, I'm not using windows programing. I am far too new to c++ to try programing in windows just yet. While my OS is windows7(x64), and my IDE is a Microsoft C++ Pro. compiler, at the moment I'm self-teaching the c++ language. I think I'm programing in DOS. I Googled for a syntax example, but could not get an example in c++ that I could understand. I am a newbie to c++ and know even less about libCurl. An example of the correct syntax in c++ code would be great. Also, If I MUST use libCurl to download a file from the web, an example of that too would be great. Is there an online tutor for libCurl? Again, thanks for your help.
An example of the correct syntax in c++ code would be great.


Every example shown to you so far has been in correct syntax. Correct syntax just means that the compiler can understand it. That aside, I think what you're asking is "please show me how to do it without using any libraries".

You're missing the point. C++ does not have any inherent knowledge of what an internet is. It does not know what a network is. It does not know what a monitor is, or a mouse, or sound, or anything like that. If you want to access the internet, you must ask the operating system to do it for you.

You can do this directly ("windows programming", as you call it) which just means using the libraries that come with windows, or you can use another library (such as libcurl) to ask the operating system for you.

Also, If I MUST use libCurl to download a file from the web, an example of that too would be great.

You don't have to, but doing it all yourself without libraries would take much longer and be much more complicated. There are some simple libcurl examples here:
http://stackoverflow.com/questions/1636333/download-file-using-libcurl-in-c-c
Topic archived. No new replies allowed.