[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Cgicc-help] A question to use Cgicc

From: Clay Dowling
Subject: Re: [Cgicc-help] A question to use Cgicc
Date: Mon, 24 Jan 2011 12:03:21 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7

On 1/21/11 4:45 AM, 朱炎顺 wrote:
> hello,
>   my dear!I am using the Cgicc library to write a CGI program.I want
> to download files throw the CGI.But how can I do?Do you have any good
> method?Thank you very much.I love u.Looking forward to your response.

CgiCC doesn't have some of the header classes you need, but it should be
relatively straight forward to create them yourself.  You'll just need
to duplicate the content type header classes with the appropriate
output. The following headers are necessary:

Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-disposition: attachment; filename=myfile.bin

You would then output the file to cout.  There is a very elegant way to
do this in C++ that's mentioned in Effective C++, but I don't recall it
off the top of my head.

If you are using a content type which would normally be displayed in
browser, such as a pdf document or picture, you can skip the last two
headers, but if you want an actual download that gets saved to disk
you'll need them.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]