int http_code = 0; FILE* fp = 0; fopen_s(&fp, "index.html", "wb"); if(fp) { // Initialize cURL CURL* curl = curl_easy_init(); // Set the file to write out to curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); // Set the URL to download curl_easy_setopt(curl, CURLOPT_URL, "www.example.com"); // Download curl_easy_perform(curl); //Get the HTTP response code curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); // Clean up curl_easy_cleanup(curl); curl_global_cleanup(); fclose(fp); }