cURL / Mailing Lists / curl-library / Single Mail


Re: Downloading files using HTTP

From: Daniel Stenberg <>
Date: Tue, 7 Oct 2003 00:16:13 +0200 (CEST)

On Mon, 6 Oct 2003, Michael Stather wrote:

> Iīve a (wxWindows) program which downloads data using cURL as following:

> curl_easy_setopt(ms_CurlHandle,CURLOPT_WRITEDATA,l_File.fp());
> if (curl_easy_perform(ms_CurlHandle) != CURLE_OK)
> ...
> L_File.fp returns a FILE* to a file opened for writing
> mURL.c_str() returns a const char *
> This part works fine for html pages, they are downloaded so that I can
> process them. The problem is when downloading a binary file, in my example a
> .DLL The file I get has the same size but different contents that the one
> which I uploaded server, and of course it doesnīt work when loaded. What can
> be the reason for this.

Are you possibly using Windows? If so, are you sure you've opened the file for
binary writes? Windows makes a difference between them.

> I thought of switching to FTP, but HTTP is just simpler, and downloading
> binary files with HTTP is possible, isnīt it?

If you're not using binary when you write the output, you'll get the exact
same problem even if you switch to FTP. You can download binary perfectly
using HTTP, yes.

 Daniel Stenberg -- curl: been grokking URLs since 1998
This email is sponsored by:ThinkGeek
Welcome to geek heaven.
Received on 2003-10-07