curl_slist_append

Syntax

#include <curl/curl.h>

struct curl_slist *curl_slist_append(struct curl_slist * list, const char * string ); 

Parameters

list Pointer to a curl_slist list.
string Pointer to the string to be added to the list.

Return Values

Pointer to a curl_slist. A null pointer is returned for any failure, otherwise the new list pointer is returned.

Description

Appends a specified string to a linked list of strings. The existing list should be passed as the first argument while the new list is returned from this function. The specified string has been appended when this function returns. curl_slist_append copies the string.

After usage, the list should be freed by using curl_slist_free_all.

Example

CURL handle;  struct curl_slist *slist=NULL;
slist = curl_slist_append(slist, "pragma:");  curl_easy_setopt(handle, 
     CURLOPT_HTTPHEADER, slist);
curl_easy_perform(handle);
curl_slist_free_all(slist); /* free the list again */ 

Do Not Call From

None.

See Also

HTTP Client Library (libcurl)
libcurl API Functions
libcurl Error Codes
curl_slist_free_all

Revision History

2013/09/18 Conversion
2013/05/08 Automated cleanup pass.
2012/05/04 Initial version.


CONFIDENTIAL