cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Need clarification on tutorial

From: Igor Korot <ikorot01_at_gmail.com>
Date: Wed, 11 Jul 2012 11:05:26 -0700

Hi, Daniel,

This is what I read:

[quote]
From http://curl.haxx.se/libcurl/c/libcurl-tutorial.html, part "Uploading
data to a Remote Site".

"
The read callback should have a prototype similar to:

 size_t function(char *bufptr, size_t size, size_t nitems, void *userp);

Where bufptr is the pointer to a buffer we fill in with data to upload
and size*nitems is the size of the buffer and therefore also the
maximum amount of data we can return to libcurl in this call. The
'userp' pointer is the custom pointer we set to point to a struct of
ours to pass private data between the application and the callback.

 curl_easy_setopt(easyhandle, CURLOPT_READFUNCTION, read_function);

curl_easy_setopt(easyhandle, CURLOPT_READDATA, &filedata);

Tell libcurl that we want to upload:

 curl_easy_setopt(easyhandle, CURLOPT_UPLOAD, 1L);
"
[/quote]

And here is what I'd like to see:

[quote]
From http://curl.haxx.se/libcurl/c/libcurl-tutorial.html, part "Uploading
data to a Remote Site".

"
The read callback should have a prototype similar to:

 size_t read_function(char *bufptr, size_t size, size_t nitems, void *userp);

Where bufptr is the pointer to a buffer we fill in with data to upload
and size*nitems is the size of the buffer and therefore also the
maximum amount of data we can return to libcurl in this call. The
'userp' pointer is the custom pointer we set to point to a struct of
ours to pass private data between the application and the callback.

 curl_easy_setopt(easyhandle, CURLOPT_READFUNCTION, read_function);

curl_easy_setopt(easyhandle, CURLOPT_READDATA, &filedata);

where userp parameter is a pointer to filedata.

Tell libcurl that we want to upload:

 curl_easy_setopt(easyhandle, CURLOPT_UPLOAD, 1L);
"
[/quote]

At least this way it will be consistent with the
http://curl.haxx.se/libcurl/c/libcurl-tutorial.html part "Handle the
Easy libcurl", where it
talks about write function.

And thank you for the FAQ pointer. I was linking against wrong lib.

Thank you.

On Wed, Jul 11, 2012 at 2:47 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Wed, 11 Jul 2012, Igor Korot wrote:
>
>> Would it be possible update the info on the link I put in my first post
>> with the proper function. At least it will be consistent with other pieces
>> of the tutorial.
>
>
> I don't understand. The document you're talking about is the
> docs/libcurl/libcurl-tutorial.3 (source) - which gets automatically webified
> and shows up at http://curl.haxx.se/libcurl/c/libcurl-tutorial.html. Can you
> please clarify exactly what and where you suggest we should edit it? As
> specific as you can!
>
> Lijo provided additional explanations for you but I don't understand how
> you're suggesting we should merge that into the document.
>
>
>> 1>tesseract.obj : error LNK2019: unresolved external symbol
>> __imp__curl_easy_init referenced in function "public: virtual bool
>> __thiscall MyApp::OnInit(void)" (?OnInit_at_MyApp@@UAE_NXZ)
>
>
> See:
>
> http://curl.haxx.se/docs/faq.html#Link_errors_when_building_libcur
>
> --
>
> / daniel.haxx.se
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-11