cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

Re: Passing char buffer pointer for PUT operation instead of file.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 26 Dec 2008 17:15:44 +0100 (CET)

On Fri, 26 Dec 2008, tamal.biswas_at_wipro.com wrote:

Please don't top-post!

> char buff[30];
> char pData[3]={'T','A','M'};
>
> int count=0;
> static size_t read_callback(void *ptr, size_t size, size_t nmemb, void
> *stream)
> {

The callback you write must mimic fread(). It should act similar to that.

> size_t retcode=0;
> char buff1[10]="TAMAL TAN";
> ptr=buff1;//want to populate ptr using data from char buffer.

ptr points to the buffer in which you should copy the data for libcurl. You
changing this pointer to something else will not lead to anything good.
Instead you'll leave the buffer at 'ptr' unmodified...

> return 9;

And then you unconditionally return 9 as if you always copy 9 useful data
bytes to the buffer libcurl handed you. Which you clearly don't...

-- 
  / daniel.haxx.se
Received on 2008-12-26

These mail archives are generated by hypermail.

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

File upload with ASP.NET