curl-users
Re: File Download
Date: Wed, 23 Mar 2011 23:34:03 -0700
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
Received on 2011-03-24