cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_WRITEDATA to FILE

From: RaptorX <graptorx_at_gmail.com>
Date: Fri, 4 Feb 2011 07:52:20 +0100

>
> I am trying to follow provided examples, to send HTTP data out to a file.
> The following code will not successfully
> send HTTP to the file ("output). Can someone please help me understand
> what is wrong with it?
>
> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_write_func);
>
>
According to the documentation you must provide a *pointer* to that
function.
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTWRITEFUNCTION

I am not a c++ coder myself but as far as i can see you are referencing a
variable there that doesnt exist. Dont you get compiler errors when you try
to compile that?

In the language I use I use a function called "RegisterCallback( )" to get
the call back pointer needed for that option, in c++ there is a similar
function i assume so you might want to do something like:

rCallBack = registercallback(<func params here>);

and then pass var to setopt, like:

curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, rCallBack);
>

Again I am not a c++ coder but thats how i assume it should be, because
thats how i do it in my language.

-- 
ΓΝΩΘΙ Σ'ΑΥΤΟΝ
*vindicta bonum vita iucundius ipsa*
++++++++++++++++++++++++++++++
-- They who can give up essential liberty to obtain a little temporary
safety, deserve neither liberty nor safety.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-04