Shall i create a cgi script with main function command line Argument ? If i can , How can i pass the data to this command line arguments ?

And shall i pass Array of data from JavaScript to cgi-script which is created in c++. How many ways are available for Passing a data from a Html Page to cgi-script ?

Recommended Answers

All 2 Replies

Gotta use the environment variables.
Google "cgi c++ tutorial"
There are several libraries that handle this for you like CGIcc.
EDIT: Oops, I (sort of) lied.
For a "GET", you need to use the "QUERY_STRING" environment variable.
For a "POST", you need to first read the "CONTENT_LENGTH" variable, then read in from stdin.

When you press Submit on the browser, the browser sends the data to your cgi program. Here is an exmple of how it works, both the html script and c code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.