CGI program help please

This is a discussion on CGI program help please within the C Programming forums, part of the General Programming Boards category; I'm having a hard time trying to figure out how to implement this. Develop a program written in C that ...

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    34

    CGI program help please

    I'm having a hard time trying to figure out how to implement this.

    Develop a program written in C that will handle encoding and decoding of
    CGI data.

    * Your program should run from a command-line interface in Linux (preferably)
    or DOS. It should prompt the user to enter these items:
    1. Name
    2. Address
    3. Phone number

    * Once you collect this data, CGI encode it and display the encoded string.

    * Decode the CGI data, and display a label and associated value (these should
    match exactly what the user entered.)

    * Do not link in or use any code except what can be found in the standard
    libraries.

    Now I can set up and make a program that will fulfill the data requirements with executable that a user runs, though I'm not sure how to convert it to CGI and display it from there. I can also make the CGI script so that if the user goes to a webpage, puts in the information in the requirements will be fulfilled. My problem is how do I encode and decode data as CGI from a command line or shell, and how can data from an executable be made into CGI data. Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,848
    So have you read any pages on the web as to how CGI works ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    34
    I've read quite a bit of information on CGI encoding, and how it works. A quick run-down from what I've learned.

    A CGI is a program that automatically runs when a user goes to a website address, or clicks a link to run the program such as something that says "click here to see the current time". The server then executes the CGI program, and the results are displayed on the user's web browser.

    My problem is understanding how a program is suppose to executed on a command line, if it is run exclusively server-side, with results in a web browser. (how I even open a web browser from a command line is something I've not been able to determine).

    I posted the same question on another website, and a post someone made made me think about the problem a bit differently. I think the problem is that I'm not suppose to create a CGI script, but rather use URL encoding and decoding methods to take care of the data that the user inputs. Does this sound more reasonable?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,848
    Yes, it seems to me like it's just an exercise in encoding and decoding a CGI request. I don't think you need to actually send it to a remote server or anything.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 01:27 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 11:58 PM
  4. Replies: 2
    Last Post: 05-10-2002, 05:16 PM
  5. redirection program help needed??
    By Unregistered in forum Linux Programming
    Replies: 0
    Last Post: 04-17-2002, 06:50 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21