cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curlpp mailing list Archives

Re: [cURLpp] C - no more download of 3914 bytes [Good]

From: Jean-Philippe Barrette-LaPierre <jpb_at_rrette.com>
Date: Mon, 25 Sep 2006 09:32:02 -0400

On Sunday 24 September 2006 08:17, Marko MILICEVIC wrote:
> My prev message is bad , very sorry !
>
> Hello,

Hi!

>
> I using lib curl in my project (Windows, GCC
> (devcpp)), i use the libcurl-3.dll, and compile with
> the argument -lcurl.
>

First, you should know that this is the mailing-list for the C++ wrapper of libcURL. So, usually we discuss about the wrapping issues here.
Usually, if you got a libcURL related question (the actual library), you should send it to corresponding mailing-list:

 http://cool.haxx.se/mailman/listinfo/curl-library

However, I'll try to answer your problem.

> My problem is:
>
> My software lunch one thread , in this thread,
> while(0) initialise libcurl and download one file, the
> problem: libcurl download only 3914 bytes ! (4 Ko in
> french)
>

This following code seem to be the problem:

> size_t write_data(char *buffer, size_t size, size_t
> len, void *userp) {
> ...
> char buff[255]; memset(buff,0,255);
> sprintf(buff,"%d",size*len);
>
> MessageBox(NULL,buffmax,"MSG",MB_OK); // 3914
> <-------
> ...

it seems you assume that size*len will be less that 255 characters. But it's probably not the case. From
the manual:

 The callback function will be passed as much data as possible in all invokes,
 but you cannot possibly make any assumptions. It may be one byte, it may be
 thousands. The maximum amount of data that can be passed to the write
 callback is defined in the curl.h header file: CURL_MAX_WRITE_SIZE.

So, you should do this in a loop taking 255 characters at a time UNTIL you've reached size*len characters.

_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp
Received on 2006-09-25

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET