cURL / Mailing Lists / curl-library / Single Mail


AW: Downloading files using HTTP

From: Michael Stather <>
Date: Tue, 7 Oct 2003 07:03:35 +0200

Yes, I had opened the file in text mode, now it works.

Many thanks for your help

Michael Stather

-----Ursprüngliche Nachricht-----
[] Im Auftrag von Daniel
Gesendet: Dienstag, 7. Oktober 2003 00:16
An: libcurl Mailing list
Betreff: Re: Downloading files using HTTP

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.
This email is sponsored by:ThinkGeek
Welcome to geek heaven.
Received on 2003-10-07