cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Help - retriveal of header & body info

From: Julien Chaffraix <julien.chaffraix_at_gmail.com>
Date: Wed, 6 Jan 2010 06:30:39 -0800

Hi,

[snipped the irrelevant code]
>      bodyfile = fopen("/homes/ body.out","w");
[...]
> Still I am not getting the information in body.out file.

You are trying to write to the file ' body.out' (note the leading
space). Could it be the cause of your issue?

> I could see that the stream is getting retrieved inside write_data
> function but its not written to the file.
>
> size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream) {
>  char* cptr = (char*)ptr;
>  cout << cptr << endl;
>  cout << cptr << endl;
>  int written = fwrite(ptr, size, nmemb, (FILE *)stream);
>  return written;
> }

You will need to debug this method to know what could go wrong. Have a
look at the output of fwrite as returning the wrong value to libcurl
would stop the transfer.

> Please let me know if you can give me some inputs why this information
> is not getting written into the file stream in UNIX.

FYI, I have tried your code on linux and it is working correctly (even
with the leading space on body.out).

Regards,
Julien
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-06