cURL / Mailing Lists / curl-library / Single Mail


Re: Encoding issue getting an image with libcURL

From: Dan Fandrich <>
Date: Tue, 8 Feb 2005 14:53:20 -0800

On Tue, Feb 08, 2005 at 12:26:19PM -1000, wrote:
> I am trying to get an image and write it to a file. It apparently works since I
> do receive an image, however the content of the image is completely wrong. When
> I compare the image I get with my code and the original, I notice some
> discrepencies. It seems to be relate to the wen carriage returns are encoded. I
> compile the following code on windows platfrom with VC++ 7.1.
> destFile = fopen("myImage.gif,"w");

You need to open the file in binary mode, so Windows won't corrupt your
end-of-line bytes. Change this line to:

          destFile = fopen("myImage.gif,"wb");

>>> Dan

--              The web change of address service
          Let webmasters know that your web site has moved
Received on 2005-02-09