cURL / Mailing Lists / curl-library / Single Mail


Problems with Http download under windows

From: Loic Quertenmont <>
Date: Mon, 30 Jun 2008 18:17:43 +0200

Dear CURL-Library experts,

I have some troubles with curl library under windows (both xp and vista).
I tried to download a file from a http path.I have tested my code
under linux and everything is fine.

The code is pretty simple :

CURL* session = curl_easy_init();
curl_easy_setopt(session, CURLOPT_URL, address);
FILE * fp = fopen(out_file, "w");
curl_easy_setopt(session, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(session, CURLOPT_WRITEFUNCTION, fwrite);

When I execute the soft, the file is downloaded (as expected) BUT :
the downloaded file is bigger than the file size. If the downloaded
file is a JPG picture. I can open it, but all the pixels in the image
are mixed. The file is clearly corrupted.

for instance the size of the downloaded file is 451.163 bytes instead
of 449.676 bytes.

Do you have any explanation ?
or much better any solution?

Can it be due to a wrong dll/lib ? (please point me to the best
dll/lib file for windows XP and Vista)

In advance, Thanks a lot.

Received on 2008-06-30