1curl_slist_append(3)            libcurl Manual            curl_slist_append(3)
2
3
4

NAME

6       curl_slist_append - add a string to an slist
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       struct  curl_slist  *curl_slist_append(struct  curl_slist  *list, const
12       char * string);
13

DESCRIPTION

15       curl_slist_append(3) appends a string to a linked list of strings.  The
16       existing  list  should be passed as the first argument and the new list
17       is returned from this function. Pass in NULL in the  list  argument  to
18       create  a  new  list.  The specified string has been appended when this
19       function returns. curl_slist_append(3) copies the string.
20
21       The   list   should    be    freed    again    (after    usage)    with
22       curl_slist_free_all(3).
23

RETURN VALUE

25       A  null  pointer  is returned if anything went wrong, otherwise the new
26       list pointer is returned.
27

EXAMPLE

29       CURL *handle;
30       struct curl_slist *slist=NULL;
31
32       slist = curl_slist_append(slist, "pragma:");
33
34       if (slist == NULL)
35         return -1;
36
37       curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist);
38
39       curl_easy_perform(handle);
40
41       curl_slist_free_all(slist); /* free the list again */
42

SEE ALSO

44       curl_slist_free_all(3),
45
46
47
48libcurl 7.61.1                   May 05, 2017             curl_slist_append(3)
Impressum