How can i download the contents of a URL using c/c++? Preferably on windows. I have already tried libcurl on linux, but i cant get it to work on windows. Any more ideas or suggestions?
Printable View
How can i download the contents of a URL using c/c++? Preferably on windows. I have already tried libcurl on linux, but i cant get it to work on windows. Any more ideas or suggestions?
Use (or take a look at the source code of) wget. There is a Windows version.
Any more suggestions? (Has anyone succeeded in installing curl and curlpp on windows? )
I use curl, you shouldn't need to install anything, you just need the library, which you can get ont he website. Make sure you download libcURL, not cURL, and download the Binary. It's GNU C, so it will work with your GNU C or C++ out of the box.
Ok, i downloaded libcurl binary and tried compiling an example that is on the site("simple.c").
I included the path of curl.h like this <curl/curl.h>, but it didnt work , so i used "curl/curl.h".
But i got a bunch of errors:
Did i do something wrong?Code:In file included from simple.c:2:
curl/curl.h:35:61: curl/curlbuild.h: No such file or directory
In file included from curl/curl.h:36,
from simple.c:2:
curl/curlrules.h:80:4: #error "CURL_SIZEOF_LONG definition is missing!"
In file included from curl/curl.h:36,
from simple.c:2:
curl/curlrules.h:81: error: syntax error before "Compilation_aborted_CURL_SIZEOF_LONG_is_missing"
curl/curlrules.h:85:4: #error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!"
curl/curlrules.h:90:4: #error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!"
curl/curlrules.h:95:4: #error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
curl/curlrules.h:100:4: #error "CURL_FORMAT_CURL_OFF_T definition is missing!"
curl/curlrules.h:105:4: #error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
curl/curlrules.h:110:4: #error "CURL_FORMAT_OFF_T definition is missing!"
curl/curlrules.h:115:4: #error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
curl/curlrules.h:120:4: #error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
curl/curlrules.h:125:4: #error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
curl/curlrules.h:142: error: syntax error before "typedef"
curl/curlrules.h:144: error: `CURL_SIZEOF_LONG' undeclared here (not in a function)
curl/curlrules.h:154: error: `curl_off_t' undeclared here (not in a function)
curl/curlrules.h:154: error: `CURL_SIZEOF_CURL_OFF_T' undeclared here (not in a function)
curl/curlrules.h:164: error: size of array `__curl_rule_03__' is negative
curl/curlrules.h:174: error: `curl_socklen_t' undeclared here (not in a function)
curl/curlrules.h:174: error: `CURL_SIZEOF_CURL_SOCKLEN_T' undeclared here (not in a function)
curl/curlrules.h:184: error: size of array `__curl_rule_05__' is negative
In file included from simple.c:2:
curl/curl.h:191: error: syntax error before "curl_off_t"
Finally i managed to link the necessary libraries and compile my programs. Thank you everyone for your advice!