cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: File Download

From: lakshmi <lakshmi_at_dikshatech.com>
Date: Thu, 24 Mar 2011 12:15:44 +0530

Sorry i know to program.. maybe you din't understand my question ! so
leave it..
Thanks for the reply

John Meissen wrote:
> Sorry, but maybe you should learn to program first. There are no loops
> in that code segment.
>
>
>> Hi,
>>
>> Can you just let me know what the below piece of code does ?? A sample
>> program from curl ..
>>
>> When the out->stream is NULL, it enters only once inside the if
>> condition but if it's not NULL, it keeps looping for many number of times !
>>
>> Please suggest ??
>>
>> static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void
>> *stream)
>> {
>> struct FtpFile *out=(struct FtpFile *)stream;
>> if(out && !out->stream) {
>> /* open file for writing */
>> out->stream=fopen(out->filename, "wb");
>> if(!out->stream)
>> return -1; /* failure, can't open file to write */
>> }
>> return fwrite(buffer, size, nmemb, out->stream);
>> }
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-users
>> FAQ: http://curl.haxx.se/docs/faq.html
>> Etiquette: http://curl.haxx.se/mail/etiquette.html
>>
>
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-users
> FAQ: http://curl.haxx.se/docs/faq.html
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
> .
>
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-24