开发者

Discard response data from libcurl

Libcurl defaults to stdout when handling a server's response. We can override it with CURLOPT_WRITEFUNCTION and CURLOPT_WRITEDATA. From the manual I got that I could set the CURLOPT_WRITEFUNCTION to NULL and then pass 开发者_Python百科a FILE * to CURLOPT_WRITEDATA. If I just want to not use it what would be the most efficient way to go about it?

Specifically, if you need to provide a FILE * to a function, but you want it to be discarded how would you go about it?

Also, as I'm writing this I realised that maybe I shouldn't pass NULL to CURLOPT_WRITEFUNCTION, and instead write a function which does nothing?


Write to /dev/null or a similar black hole. Note that the existence and location of such special file(s) is OS dependent - Unixen have /dev/null, Windows has \Device\Null, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜