Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accepting arguments on as a CGI 1

Status
Not open for further replies.

fortytwo

Technical User
Apr 18, 2000
206
GB
Hi,

I have the following really simple code:
[tt]
#include <iostream.h>
int main(int argc, char * argv[]) {
int count;
cout << &quot;Content-type: text/plain&quot; << endl << endl;
for (count = 0; count <= (argc - 1); count++) {
cout << argv[count] << endl;
}
return(0);
}
[/tt]
that just prints out an argument list. It works fine on the command line, and if I address it in a web browser:


it outputs:
[tt]
program
test
[/tt]
but when I do:


it just outputs:
[tt]
program
[/tt]
How do I get parameter/value pairs when calling a c++ program as a cgi?

Thanks
Will.
fortytwo
will@hellacool.co.uk
 
Input values are never sent on the command line with any CGI. The fieldnames and values are available to a CGI in two ways:

If the HTML <form> tag uses the GET method, the form data will be available in an environment variable named &quot;QUERY_STRING&quot;.

If the <form> tag uses the POST method, the data will be available to the CGI via STDIN. ______________________________________________________________________
TANSTAAFL!
 
Also look for uncgi on the web. It translates input vars into environment variables...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top