GNURLOPT_READDATA(3)
π GNURLOPT_READDATA(3) π
okay so bestie, this is the GNURLOPT_READDATA(3) page from the curl_easy_setopt options manual, and it's all about a custom pointer that gets passed to the read callback. iykyk π
πΈ NAME πΈ
CURLOPT_READDATA β custom pointer passed to the read callback. literally that's the whole vibe π«Ά
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_READDATA, void
*pointer);
π¦ DESCRIPTION π¦
Data pointer to pass to the file read function. if you use the CURLOPT_READFUNCTION(3) option, this is the pointer you'll get as input in the 4th argument to the callback. no cap.
If you don't specify a read callback but instead rely on the default internal read function, this data must be a valid readable FILE * (cast to 'void *'). yes, that's the assignment π
β οΈ win32 DLL bestie alert: if you're using libcurl as awin32 DLL, you MUST use aCURLOPT_READFUNCTION(3)if you set this option β or you will experience crashes π. not a drill, fr fr.
π DEFAULT π
By default, this is a FILE * to stdin. iconic default behavior, honestly.
π PROTOCOLS π
This is used for all protocols when sending data. all of them. periodt.
π EXAMPLE π
here's the little code moment, bestie:
CURL *curl = curl_easy_init();
struct MyData this;
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* pass pointer that gets passed in to the
CURLOPT_READFUNCTION callback */
curl_easy_setopt(curl, CURLOPT_READDATA, &this);
curl_easy_perform(curl);
}
π§ AVAILABILITY π§
This option was once known by the older name CURLOPT_INFILE; the name CURLOPT_READDATA(3) was introduced in 7.9.7. glow-up era π«
π RETURN VALUE π
This will return CURLE_OK. short, sweet, slay.
π₯ SEE ALSO π₯
CURLOPT_READFUNCTION(3), CURLOPT_WRITEDATA(3), β yep, that trailing comma is in the original, periodt π
okay that's the whole page, bestie β GNURLOPT_READDATA(3) from libcurl 7.37.0, dated 16 Jun 2014. mwah πβ¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms