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

RE: CGI howto



These questions might be better posed at comp.lang.c
There may be a newsgroup for cgi issues, I'm not certain.  But there's a
wealth of information out there and some nice libraries like cgic that make
easy work of it.

In your code:

Change

	void main() 

to 

	int main()

If you are returning an integer.

--
	See: http://www.faqs.org/faqs/C-faq/faq/
	"11.12a:	What's the correct declaration of main()?"
But note that you must return either nothing, or whatever you set typedefed
as the return value.



-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com">mailto:owner-dev-etrax@xxxxxxx.com] On Behalf
Of willie wortel
Sent: Thursday, April 06, 2006 13:51
To: dev-etrax@xxxxxxx.com
Subject: RE: CGI howto

#include <stdio.h>

void main() {

    /** Print the CGI response header, required for all HTML output. **/
    /** Note the extra \n, to send the blank line.                   **/
    printf("Content-type: text/html\n\n") ;
    
    /** Print the HTML response page to STDOUT. **/
    printf("<html>\n") ;
    printf("<head><title>CGI Output</title></head>\n") ;
    printf("<body>\n") ;
    printf("<h1>Hello, world.</h1>\n") ;
    printf("</body>\n") ;
    printf("</html>\n") ;

    exit(0) ;
} 

This works for me :)

The compiler warns about an "explicit use of exit(0)" , but it works ,
however not at once but after an reboot, all went ok.