1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_SIZE_DOWNLOAD_T 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_SIZE_DOWNLOAD (3) 9 - CURLINFO_SIZE_UPLOAD_T (3) 10 - CURLOPT_MAXFILESIZE (3) 11 - curl_easy_getinfo (3) 12 - curl_easy_setopt (3) 13--- 14 15# NAME 16 17CURLINFO_SIZE_DOWNLOAD_T - get the number of downloaded bytes 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SIZE_DOWNLOAD_T, 25 curl_off_t *dlp); 26~~~ 27 28# DESCRIPTION 29 30Pass a pointer to a *curl_off_t* to receive the total amount of bytes that 31were downloaded. The amount is only for the latest transfer and gets reset 32again for each new transfer. This counts actual payload data, what's also 33commonly called body. All meta and header data is excluded from this amount. 34 35# PROTOCOLS 36 37All 38 39# EXAMPLE 40 41~~~c 42int main(void) 43{ 44 CURL *curl = curl_easy_init(); 45 if(curl) { 46 CURLcode res; 47 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 48 49 /* Perform the request */ 50 res = curl_easy_perform(curl); 51 52 if(!res) { 53 /* check the size */ 54 curl_off_t dl; 55 res = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &dl); 56 if(!res) { 57 printf("Downloaded %" CURL_FORMAT_CURL_OFF_T " bytes\n", dl); 58 } 59 } 60 } 61} 62~~~ 63 64# AVAILABILITY 65 66Added in 7.55.0 67 68# RETURN VALUE 69 70Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 71