[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: could we use c replace perl in cgi program?



eric lin <fsshl@centurytel.net> writes:
> Dear advanced webprogramers or linuxer:
>
>    Could we using c replace perl in cgi programming?

Sure, nothing's intrinsically tied to Perl at all.  Look at
http://hoohoo.ncsa.uiuc.edu/cgi/overview.html for the CGI
specification, including a listing of the environment variables that
could be set.

> I tried a simple c program(although it not compile write)
> to parse the name and value it inherate from visitor hit the submit form
>
> ------------------------------------------------
>
> #include <stdio.h>
>
> int main()
> {
>           extern char name[][];
>           extern char value[][];
>
>
>           printf("Content-type: text/html\n\n");
>           printf("<html><body>\n");
>           printf("the price fo ", name[1], " equal ", value[1], "\n");
>           printf("</body></html>");
> }
>
> --------------------------------------------------------------

Well, sure, where do you expect name and value to actually be defined?
(I don't think 'extern' is allowed to modify local variables in any
case.)  You also might look for C CGI libraries if this would make you
happy; there seems to be a libcgicg1-dev package in unstable, which
appears to provide the right functionality.

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: