libcurl手册-CURLOPT_WRITEDATA

CURLOPT_WRITEDATA(3) curl_easy_setopt options

CURLOPT_WRITEDATA(3)

NAME

复制代码
   CURLOPT_WRITEDATA - pointer passed to the write callback

SYNOPSIS

cpp 复制代码
#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WRITEDATA, void *pointer);

DESCRIPTION

复制代码
   A  data  pointer  to  pass  to the write callback. If you use the CURLOPT_WRITEFUNCTION(3) option, this is the
   pointer you will get in that callback's fourth and last argument. If you do not use a write callback, you must
   make pointer a 'FILE *' (cast to 'void *') as libcurl will pass this to fwrite(3) when writing data.

   The  internal  CURLOPT_WRITEFUNCTION(3) will write the data to the FILE * given with this option, or to stdout
   if this option has not been set.

   If you are using libcurl as a win32 DLL, you MUST use a CURLOPT_WRITEFUNCTION(3) if you set this option or you
   will experience crashes.

要注意Win32 DLL下,如果设置了这个选项,就必须设置CURLOPT_WRITEFUNCTION,否则程序会崩溃。

DEFAULT

复制代码
   By default, this is a FILE * to stdout.

PROTOCOLS

复制代码
   Used for all protocols.

EXAMPLE

复制代码
   A  common  technique  is to use the write callback to store the incoming data into a dynamically growing allo‐
   cated buffer, and then this CURLOPT_WRITEDATA(3) is used to point to a struct or the buffer to store data  in.
   Like in the getinmemory example: https://curl.se/libcurl/c/getinmemory.html

AVAILABILITY

复制代码
   Available  in  all  libcurl  versions. This option was formerly known as CURLOPT_FILE, the name CURLOPT_WRITE‐
   DATA(3) was introduced in 7.9.7.

RETURN VALUE

复制代码
   This will return CURLE_OK.

SEE ALSO

复制代码
   CURLOPT_WRITEFUNCTION(3), CURLOPT_READDATA(3),

libcurl 7.88.1 January 02, 2023 CURLOPT_WRITEDATA(3)

相关推荐
busy dog~乌鸦~30 分钟前
【THM-题目答案】:Web Fundamentals-How The Web Works-DNS in Detail: Domain Hierarchy
运维·web安全·网络安全·系统安全
奇妙之二进制2 小时前
zmq源码分析之own_t
服务器·网络
北山有鸟2 小时前
【学习笔记】MIPI CSI-2 协议全解析:从底层封包到像素解析
linux·驱动开发·笔记·学习·相机
mounter6252 小时前
深度解析:Linux 内核为何要移除“直接映射” (Direct Map)?
linux·运维·服务器·security·linux kernel·direct mem map
AC赳赳老秦2 小时前
HR必备:OpenClaw批量筛选简历、发送面试通知,优化招聘流程
运维·人工智能·python·eclipse·github·deepseek·openclaw
NineData2 小时前
NineData亮相香港国际创科展InnoEX 2026,以AI加速布局全球市场
运维·后端
another heaven3 小时前
【Docker/虚拟机 深度对比Docker与虚拟机:原理、区别与最佳使用场景】
运维·docker·容器
带娃的IT创业者3 小时前
零停机迁移:如何将服务器成本从 $1432 降至 $233
运维·服务器·网络·成本优化·服务器迁移·零停机·hetzner
bugu___3 小时前
Linux系统、网络知识点回顾1
linux·网络
独自归家的兔3 小时前
2026年4月16日 Ubuntu系统 Docker 的安装与配置
运维·docker·容器