CURLOPT_READDATA(3)
πΈ NAME πΈ
okay bestie, welcome to the CURLOPT_READDATA(3) page β it's from the Library Functions Manual, and it's literally about the pointer passed to the read callback. no cap, that's the whole vibe. π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_READDATA, void *pointer);
π DESCRIPTION π
so here's the tea: this is the data pointer to pass to the file read function. if you use the CURLOPT_READFUNCTION(3) option, this is the pointer you get as input in the fourth argument to the callback. iykyk. π«Ά
if you do not specify a read callback but instead rely on the default internal read function, this data must be a valid readable FILE * (cast to 'void *'). like, it has to actually be readable, bestie β no random pointer shenanigans. π
π¨ Windows DLL bestie alert: if you are using libcurl as a DLL on Windows, you must use the CURLOPT_READFUNCTION(3) callback if you set this option. otherwise you might experience crashes. and not the cute kind. π
π DEFAULT π
stdin β yes, the default is literally stdin. standard input main character energy. β¨
π¦ PROTOCOLS π¦
This functionality affects all supported protocols. all of them. periodt. π
π EXAMPLE π
here's the example, untouched and iconic: π
struct MyData {
void *custom;
};
int main(void)
{
CURL *curl = curl_easy_init();
struct MyData this;
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* pass pointer that gets passed in to the
CURLOPT_READFUNCTION callback */
curl_easy_setopt(curl, CURLOPT_READDATA, &this);
curl_easy_perform(curl);
}
}
π HISTORY π
This option was once known by the older name CURLOPT_INFILE; the name CURLOPT_READDATA(3) was introduced in 7.9.7. glow-up moment fr fr. β
β AVAILABILITY β
Added in curl 7.9.7. π
π₯ RETURN VALUE π₯
This returns CURLE_OK. slay. β
π SEE ALSO π
mwah π that's the whole page! this was the libcurl manual, dated 2026-10-12 β CURLOPT_READDATA(3) from the Library Functions Manual, signing off. π«ΆπΈ
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms