Я изучаю библиотеку libcurl в C ++. Хотите попробовать простой вариант использования: "Пока идет загрузка, я хочу, чтобы моя программа прервалась, если получен SIGINT." Я попытался найти параметры curl_easy_setopt, но я не нашел таких. Я думаю, что CURLOPT_NOSIGNAL не поможет мне справиться с SIGINT.
Есть предложения?
Мой тестовый код:
CURL *curlhandle = NULL;
curl_global_init(CURL_GLOBAL_SSL);
curlhandle = curl_easy_init();
if ( curlhandle ) {
curl_easy_setopt(curlhandle, CURLOPT_NOSIGNAL, 0L);
curl_easy_setopt(curlhandle, CURLOPT_URL, "myURL/samplefile");
curl_easy_setopt(curlhandle, CURLOPT_TIMEOUT, 60);
FILE *file = fopen("filepath", "wb");
if(file) {
curl_easy_setopt(curlhandle, CURLOPT_WRITEDATA, (void*)file);
/* get it! */
res = curl_easy_perform(curlhandle);
/* close the file */
fclose(file);
}