cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Certain filetypes recieved with libcurl are corrupted

From: Ben Combee <ben.combee_at_gmail.com>
Date: Fri, 4 Jul 2008 14:57:56 -0500

On Fri, Jul 4, 2008 at 2:40 PM, Aaron M <ajaymills_at_gmail.com> wrote:
> Hello! This seems like a very odd problem. All my code here is designed to
> do (for the moment), is to be passed a single flag from the commandline
> which dictates the name of the file to create. A fixed URL is accessed and
> it's contents are saved to that file. What's strange here though, is that
> specifically for doc files and pdf files, the resulting file is corrupt. It
> isn't empty, and even retains some of the file properties as the original
> (creator, keywords, etc), but for pdfs there is no text inside, and for
> docs, MSWord can not even open it. Does anything seem wrong in my code? Has
> anyone seen a simple example very similar, perhaps?
>
> http://myweb.unomaha.edu/~amills/datasheetCL.cpp
>

Since this is running on Windows, try creating your ofstream with
(ios::binary | ios::out).
Received on 2008-07-04