RosettaCodeData/Task/FTP/BaCon/ftp-1.bacon

18 lines
456 B
Plaintext

OPTION PARSE FALSE
PRAGMA INCLUDE <curl/curl.h>
PRAGMA LDFLAGS -lcurl
DECLARE easyhandle TYPE CURL*
OPEN "data.txt" FOR WRITING AS download
easyhandle = curl_easy_init()
curl_easy_setopt(easyhandle, CURLOPT_URL, "ftp://localhost/pub/data.txt")
curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, download)
curl_easy_setopt(easyhandle, CURLOPT_USERPWD, "anonymous")
success = curl_easy_perform(easyhandle)
curl_easy_cleanup(easyhandle)
CLOSE FILE download