WRITING A CGI IN C

Could you someone tell me the logic and the initial code to get the variables in a POST case and how I can test it under DOS. I am confused by what is an environment variable and what is not.
Thx for your help.

toulonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

szetoaCommented:
In the form if you use POST, you have to read your data from stdin.  Using GET you have to read from an environment variable.  Here's the example of using POST:

char buffer[BUFSIZ];
long len;

len = atol(getenv("CONTENT_LENGTH"));
fread(buffer, len,1,stdin);
0
shiversCommented:
further to szetoa's comment...

the data you read in from stdin takes the form of a list of identifier/value pairs.  Each pair is separated by a '&' sign, and the id and vlue are seperated by a '=' sign.  note that some identifiers may not have values set

all spaces are encoded to the '+' character, and illegal characters (such as '+', '&', '=', and extended chars) are encoded using '%xx' where xx specifies the ASCII value of the character in hex.  (there may be other encodings than ASCII - but i'm unaware of the details)

shout if you need any more info
0
toulonAuthor Commented:
thx for the inputs. could you make it an answer so I could give you the points an close the question ?
Thx
0
shiversCommented:
not sure if u mean me - but i thought i'd shove this in anyways - shout if u want any more details

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.