hi, I´m supposed to make a webpage for my c++ program. I have made the
program but I´m a terrible newbie at cgi. My program takes three strings,
manipulates them (goes through some other classes) and returns basically
three strings. I´m working on a unix computer. I had no problem making the
easy html page with the buttons and all that, it's the CGI part vs. the
C++ part I dont know. I kinda know how to parse the input string but I'm
not sure how to get it to the .cgi file. Do I make my C++ file and compile
it to cgi? How do I then get the values into the c++ file? Do I have to
compile every class to a cgi file or just the main one or maybe even none,
and I have a separate cgi file that utilizes the c++ classes?
I hope you understand what I´m trying to do.
C++ is a compiled language. CGI is a method with which the web server can
invoke external programs. You can compile C++ into binary executable, but
saying "C++ file and compile it to cgi" makes no sense.
A CGI program is just a program that reads the environment variables, the
standard input and writes the standard output.
If you want to handle CGI input from C or C++ you can download my
ScriptBasic interpreter that has a CGI module with a file cgi.c fully
documented. This is pure C and provides functions to handle CGI input
(output is simple printf), with cookies, form variables, uploaded files,
overloaded form variables so everithing that can happen in CGI input.
[ back to toc ]