Streaming or downloading a text file from URL with C++

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2009
Posts: 2
Reputation: madmaze is an unknown quantity at this point 
Solved Threads: 0
madmaze madmaze is offline Offline
Newbie Poster

Streaming or downloading a text file from URL with C++

 
0
  #1
Oct 19th, 2009
Hello there,
What would be a simple way to stream a file from a url?
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 2
Reputation: madmaze is an unknown quantity at this point 
Solved Threads: 0
madmaze madmaze is offline Offline
Newbie Poster
 
0
  #2
Oct 19th, 2009
Originally Posted by madmaze View Post
Hello there,
What would be a simple way to stream a file from a url?
I figured it out.. Im using libcURL\

  1. #include <curl/curl.h>
  2.  
  3. CURL *curl;
  4. CURLcode results;
  5.  
  6. curl = curl_easy_init();
  7. if(curl) {
  8. curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
  9. results = curl_easy_perform(curl);
  10. cout<<"results: "<<sizeof(results)<<" "<<results<<endl;
  11. /* always cleanup */
  12. curl_easy_cleanup(curl);
  13. }

to include the right libs when linking type:
  1. $curl-config --libs
  2. -lcurl -lidn -llber -lldap -lrt -lgssapi_krb5 -lgssapi_krb5 -lz -lgnutls
  3. $

and it will display all the needed libs
Reply With Quote Quick reply to this message  
Reply

Tags
c++, download, file, stream, url

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC