Re: binary mode on Win32 but LF becomes CRLF
Date: Tue, 8 Jun 2004 23:08:02 +0200
Rowe David W said:
> I have been having a problem with a binary mode transfer on Win32.
> I have a cgi program which will retrieve a file with http and write it
> to stdout.
> I have set the mode of stdout to binary.
> All LFs are being converted to CRLF pairs.
> I have found that by setting the CURLOPT_WRITEFUNCTION to fwrite with
> CURLOPT_WRITEDATA set to stdout the problem goes away. (See code
> fragment below.)
Only cause I can think of is if libcurl.dll and the application was
linked with different runtime libraries. E.g. libcurl.dll was compiled
with "cl /MD" and your application with "cl /MDd". Or mixed /ML and
/MD (but I don't think that will link). MSVC is very picky about such
things and a pain to debug.
This could cause stdout in the application and stdout in libcurl to
refer to different FILES. Since the WRITEFUNCTION refers to stdout
initially, using that option shouldn't make a difference at all.
Hence setting binary mode should be enough.
> As an aside I needed to add
> to "project settings\link\project options" in VC6 to build 7.12.0.
Why? A project using libcurl.dll shouldn't need to rebuild that
DLL. Just add the libcurl.lib import lib and put libcurl.dll in current
directory or on your PATH.
Received on 2004-06-08