Igor Korot | 10 Jul 2012 05:08
Picon

Need clarification on tutorial

Hi, ALL,
My name is Igor Korot and I'm starting to use CURL library as a developer.

However I need some clarification since I'm not comprehending what is written in
tutorial.

I'm trying to read
http://curl.haxx.se/libcurl/c/libcurl-tutorial.html, part "Uploading
data to a Remote Site". Here is excerpt from it:

"
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);
"

(Continue reading)

Lijo Antony | 11 Jul 2012 07:31
Picon
Favicon

Re: Need clarification on tutorial

On 07/10/2012 07:08 AM, Igor Korot wrote:
> 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);
> "
>
> Now in this piece if I'm reading correctly, "read_function =
> function". Is this correct?

yes. read_function stands for a function with signature "size_t 
function(char *bufptr, size_t size, size_t nitems, void *userp);", which 
is provided by the user.

>
> And "filedata = bufptr". Is this correct?

(Continue reading)

Igor Korot | 11 Jul 2012 09:56
Picon

Re: Need clarification on tutorial

Thank you for the clarification, Lijo.

1. Would it be possible to clarify at least point one in the link I referenced?

2. Does anybody works with libcurl on Windows with MSVC 2010?
I did successfully compile the library with it by using provided
vc6.dsw file, but then
trying to use it in my own project I am getting a link error on every single
libcurl.
I did update my project properties, the compiler didn't complain, only linker.

I can post my project if needed.

Thank you.

On Tue, Jul 10, 2012 at 10:31 PM, Lijo Antony <lta <at> one.com> wrote:
> On 07/10/2012 07:08 AM, Igor Korot wrote:
>>
>> 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);
>>
(Continue reading)

Lijo Antony | 11 Jul 2012 10:33
Picon
Favicon

Re: Need clarification on tutorial

On 07/11/2012 11:56 AM, Igor Korot wrote:
> 1. Would it be possible to clarify at least point one in the link I referenced?

I am sorry, I didn't get you. Could you ask your question again?

> 2. Does anybody works with libcurl on Windows with MSVC 2010?
> I did successfully compile the library with it by using provided
> vc6.dsw file, but then
> trying to use it in my own project I am getting a link error on every single
> libcurl.
> I did update my project properties, the compiler didn't complain, only linker.
>
> I can post my project if needed.
>

More info, like the specific link errors would be helpful.

-lijo
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Igor Korot | 11 Jul 2012 10:56
Picon

Re: Need clarification on tutorial

Hi,

On Wed, Jul 11, 2012 at 1:33 AM, Lijo Antony <lta <at> one.com> wrote:
> On 07/11/2012 11:56 AM, Igor Korot wrote:
>>
>> 1. Would it be possible to clarify at least point one in the link I
>> referenced?
>
>
> I am sorry, I didn't get you. Could you ask your question again?

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.

>
>
>
>> 2. Does anybody works with libcurl on Windows with MSVC 2010?
>> I did successfully compile the library with it by using provided
>> vc6.dsw file, but then
>> trying to use it in my own project I am getting a link error on every
>> single
>> libcurl.
>> I did update my project properties, the compiler didn't complain, only
>> linker.
>>
>> I can post my project if needed.
>>
(Continue reading)

Daniel Stenberg | 11 Jul 2012 11:47
Picon
Favicon
Gravatar

Re: Need clarification on tutorial

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 <at>  <at> 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

(Continue reading)

Igor Korot | 11 Jul 2012 20:05
Picon

Re: Need clarification on tutorial

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:
(Continue reading)


Gmane