cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: problem with CURL

From: Martin C. Martin <martin_at_metahuman.org>
Date: Wed, 12 Feb 2003 23:19:17 -0500

He's not, but the problem is close:

                for(int i=last_c; i<s; i++)
                        buf[i] = t_buffer[i];

should be:

if (s > 15999)
  s = 15999;
for (int i = 0; i < s; i++)
   buf[i + last_c] = t_buffer[i];

You could probably have figured that out when you stepped through the
debugger; you'd see all your data coming in, yet you'd see some of it
overwriting others of it. Or, you could have printed out "buffer," "buf"
at the start of the call, and "buf" at the end of the call.

While you're at it, read up on the function "fgets()." And there's no
need to put your write_data() function in an extern "C" block.

- Martin

RBramante_at_on.com wrote:
>
> Try not reinitializing last_c to 0 at the start of every write_data
> callback.
>
>
> "Fig TaTam"
> <fig_tatam_at_hotmail.com> To: curl-library_at_lists.sourceforge.net
> Sent by: cc:
> curl-library-admin_at_lists.sour Subject: problem with CURL
> ceforge.net
>
>
> 02/12/2003 07:45 PM
> Please respond to
> curl-library
>
>
>
> I'm new to cURL and there's something wrong with my program.
> What I'm trying to do is: download webpage source into a buffer. That's it.
>
> What I get is a buffer that contains the begining and end of the webpage,
> plus a few things from the middle. Most of the data is missing.
>
> Here's my source code: http://64.60.177.194/blah.cpp
> I have tried different URLs, but the one I really want to use is this:
> http://www.jossh.com/jgeng/PilotViewer?p=squik
>
> Anyone know what may cause the program to recieve only a portion of a file?
> and how to fix it?
>
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8.
> http://join.msn.com/?page=features/junkmail
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-02-13