std::vector<char> DownloadDCConFromImagePath(const std::string& imagePath) {
CURL* curl;
CURLcode res;
struct curl_slist* headers = nullptr;
std::vector<char> responseData;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, [](void* ptr, size_t size, size_t nmemb, void* userdata) -> size_t {
((std::vector<char>*)userdata)->insert((std::vector<char>*)userdata, (char*)ptr, size * nmemb);
return size * nmemb;
});
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &responseData);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl;
}
curl_easy_cleanup(curl);
curl_slist_free_all(headers);
}
return responseData;
}
가지고 꺼져