Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<curl/curl.h>
- #include<string.h>
- int channelDownload(char *ch_name, char *ch_address)
- {
- CURL *curl;
- char *f_name = malloc(100*sizeof(char));
- char path[100] = "./channels/";
- strcpy(f_name, ch_name);
- strcat(f_name, ".xml");
- strcat(path, f_name);
- printf("Trwa pobieranie kanalu %s... \n", ch_name);
- FILE *tmp = fopen(path, "w");
- CURLcode curl_res;
- CURLINFO info;
- curl = curl_easy_init();
- if(curl)
- {
- curl_easy_setopt(curl, CURLOPT_URL, ch_address);
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, tmp);
- curl_res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
- }
- if(curl_res == 0)
- printf("Pobieranie zakonczone!\n");
- else
- printf("Nie udalo sie pobrac danych!\n");
- return 0;
- }
- ~
Add Comment
Please, Sign In to add comment