Sortix cross-volatile manual
This manual documents Sortix cross-volatile. You can instead view this document in the latest official manual.
CURLOPT_SEEKFUNCTION(3) | Library Functions Manual | CURLOPT_SEEKFUNCTION(3) |
NAME
CURLOPT_SEEKFUNCTION - user callback for seeking in input streamSYNOPSIS
#include <curl/curl.h>
/* These are the return codes for the seek callbacks */
#define CURL_SEEKFUNC_OK 0
#define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */
#define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking cannot be done, so
libcurl might try other means instead */
int seek_callback(void *clientp, curl_off_t offset, int origin);
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKFUNCTION, seek_callback);
DESCRIPTION
Pass a pointer to your callback function, which should match the prototype shown above.DEFAULT
NULLPROTOCOLS
This functionality affects all supported protocolsEXAMPLE
#include <unistd.h> /* for lseek */
struct data {
int our_fd;
};
static int seek_cb(void *clientp, curl_off_t offset, int origin)
{
struct data *d = (struct data *)clientp;
lseek(d->our_fd, offset, origin);
return CURL_SEEKFUNC_OK;
}
int main(void)
{
struct data seek_data;
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_cb);
curl_easy_setopt(curl, CURLOPT_SEEKDATA, &seek_data);
}
}
AVAILABILITY
Added in curl 7.18.0RETURN VALUE
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.SEE ALSO
CURLOPT_DEBUGFUNCTION(3), CURLOPT_IOCTLFUNCTION(3), CURLOPT_SEEKDATA(3), CURLOPT_STDERR(3)2024-12-28 | libcurl |