curl-library
Re: libcurl win32 package - image download corrupted
Date: Thu, 29 Sep 2011 22:26:07 +0400
Hello Opel,
Thursday, September 29, 2011, 8:49:59 PM, you wrote:
OF> Here's the code for grabbing the image:
... skipped ...
OF> FILE* outputfile = fopen(filename,"w");
You are opening the output file without specifying if it is a text
file or a binary one. On OSX (and UNIX) this makes no difference, but
on Windows, text files are different from binary ones.
OF> I compared an
OF> image with its corrupted version and it seems that there are
OF> single bytes missing in between, or are flipped - I can't make
OF> sense out of it, but for an aproximately 80kB image, I had 6 bytes
OF> missing in the entire bytestream and that caused the mess.
This looks pretty much like you were writing to the file opened in
text mode.
OF> Can somebody check this? I suspect that it is a bug somewhere in
OF> the libcurl code, since the same stuff works great on OSX.
Try opening the output file specifically in binary mode:
FILE* outputfile = fopen(filename,"wb");
-- Best regards, Tetetest mailto:tetetest_at_rambler.ru ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2011-09-29