In fact there is a typo (same one in POSTQUOTE and QUOTE)
struct curl_slist *h = NULL;
h = curl_slist_append(h, "SYST");
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
/* pass in the FTP commands to run */
curl_easy_setopt(curl, CURLOPT_PREQUOTE, headerlist);
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
$ gcc -Wall -std=c11 example.c -o example $(curl-config --cflags --libs)
example.c: In function ‘main’:
In file included from /usr/include/curl/curl.h:2402:0,
from example.c:3:
example.c:39:49: error: ‘headerlist’ undeclared (first use in this function)
res = curl_easy_setopt(curl, CURLOPT_PREQUOTE, headerlist);
The curl_easy_setopt call should be instead: curl_easy_setopt(curl, CURLOPT_PREQUOTE, h);
I did this
Copie/Paste the example...
I expected the following
I expect the example to work... it does not!
In fact there is a typo (same one in POSTQUOTE and QUOTE)
The curl_easy_setopt call should be instead:
curl_easy_setopt(curl, CURLOPT_PREQUOTE, h);
Alternatively, the example could start with:
... which is probably a better option because 'headerlist' is a more self descriptive variable than 'h':
The text was updated successfully, but these errors were encountered: