C++ CGI FAQ or Ask a Question

C++ CGI Information and Variable Wrapper Libraries

 Homepage: Variable Wrapper | HOW-TO do CGI with C | References | PurplePixie Main

C++ CGI in General

Do I need any special libraries or other facilities for CGI?
No, CGI I/O is done using stdin, stdout and environment variables. To execute the CGI you will need a properly configured web server (and obviously have compiled a binary compatible to run on the web server).

Can I compile my CGI under Windows and upload to a Unix based server?
Sort of. Like any binary code, the binary (executable) must be compiled to run in the target environment. You can build for a different target environment than the compiler is run in (with some compilers), but this is quite technical and the basic answer is no.

How do I enable my webserver to run CGIs?
Varys quite drastically dependent on the web server. Most servers will, by default, provide a cgi-bin folder for CGIs in the same directory as your html root folder. Apache, for example, can handle CGI permissions on a site, directory or URL basis. Most hosting companies will offer CGI support but usually at a premium and remember you must build the CGI for the server architecture. Very very good hosting companies like (blatant plug) Verrotech Industries provide an Enterprise Hosting account that allows you to upload Linux i386 CGI binaries (another blatant plug: prices for Enterprise Hosting start at just 25 uk pounds per month, why not request a quote from them?


The PurplePixie CGI C++ Wrapper

Is it free?
Pretty much free for use and molestation under the GNU Public Licence ( http://www.gnu.org).

What does it do?
Parses input either automatically (determines GET or POST then takes appropriate action) or from a user-passed QUERY_STRING into a searchable linked list of basically char* pointers. These can then be Fetched or Set by the user. The Wrapper can also dump the contents of it's variable list to stdout (for debug), as <input type=hidden> tags for use in a form or as a QUERY_STRING (URL Encoded List) to stdout for use in a URL.

Why use it?
Saves time especially on smaller applications so you don't need to actually re-write a bloody variable handler for each application.

Are there alternatives?
Yes. A significantly more heavy-weight (though probably in fact easier to use) solution that I have not tried an cannot directly vouch for (though it is from those saintly and divine beings called GNU so liable to kick more ass than a drunken polish sailor) is cgicc which can be found at http://www.gnu.org/software/cgicc/cgicc.html.

Ask a Question

We cannot guarentee to answer any questions you ask but we shall try and if it crops up a few times, add it to the FAQ. Obviously your email address and the such remain confidential.

Your Email

Your Question


© Copyright 2004-2007 purplepixie.org, all rights reserved.