RE: Problems with Http download under windows
Date: Mon, 30 Jun 2008 11:05:14 -0700
Loic Quertenmont wrote:
> I have just found the error
> FILE * fp = fopen(out_file, "w");
> FILE * fp = fopen(out_file, "wb");
> Because we are working with binary files and not txt file.
> the strange thing is that it works perfectly under linux (strange
> ;) )
> 2008/6/30, Joe Nardone <jnardone_at_gmail.com>:
> > > curl_easy_setopt(session, CURLOPT_WRITEFUNCTION, fwrite);
> > What is your implementation of the "fwrite" function?
> > If this is the c-library "fwrite" then you have not read the docs
> > j
Basically, you are using the default behavior of libcurl, but doing so
in a way which may confuse future maintainers of your code.
All you really have to do is
- perform your fopen() call with whatever options you want,
- pass the FILE * variable to libcurl via the CURLOPT_WRITEDATA option,
- set the write callback function to NULL.
Libcurl will guarantee that this works across all platforms, and not
Received on 2008-06-30