Home » Cloud Technologies » Download file to directory using curl – C program

Download file to directory using curl – C program

Following C program download some file from remote location to the directory mentioned in program. As an example we are trying to download curl source code from https://curl.haxx.se/download/curl-7.69.1.tar.gz to /tmp directory as /tmp/curl-7.69.1.tar.gz

This c program passes two arguments to function curl_download_file_to_directory,

  • Remote file to download – example https://curl.haxx.se/download/curl-7.69.1.tar.gz
  • Local File & directory where to save – example : /tmp/curl-7.69.1.tar.gz

Once the program execution is completed, i.e. download from remote location to local file is done, we will the file got downloaded at /tmp as,

Reference – https://curl.haxx.se/libcurl/c/ftpget.html

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment