Advertisement
Guest User

Untitled

a guest
Apr 4th, 2014
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. #ifndef md5hashDest_getFiles_h
  2. #define md5hashDest_getFiles_h
  3.  
  4. #include <curl/curl.h>
  5. #include <string>
  6. #include <stdio.h>
  7. #include <iostream>
  8.  
  9.  
  10. class getFiles {
  11.     CURL *curl;
  12.     CURLcode res;
  13.     std::string URL;
  14.     struct FtpFile {
  15.     std::string filename;
  16.     std::string destination;
  17.     FILE *stream;
  18.     }ftpfile;
  19.    
  20. public:
  21.     // CURL CONSTRUCTOR
  22.     getFiles(std::string filen, FILE *file = NULL, std::string urlname = "http://localhost/updates/") {
  23.         getDir(filen);
  24.         ftpfile.filename = filen;
  25.         ftpfile.stream = file;
  26.         URL = urlname;
  27.         curl_global_init(CURL_GLOBAL_DEFAULT);
  28.         curl = curl_easy_init();
  29.     }
  30.     // CURL DESTRUCTOR
  31.     ~getFiles() {
  32.         curl_global_cleanup();
  33.         //std::cout << "/////////////////////////////////////////" << std::endl << "       DESTRUCTOR CALLED!" << std::endl;
  34.     }
  35.     static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream);
  36.  
  37.     void run();
  38. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement