Coder's Guild Mailing List

Re: Apache

Posted by Weasel on 1999-03-27

Kelly Ng wrote:
> 
> I tried to do it in C :
> 
> #include <stdio.h>
> 
> void main(void)
> {
>         printf("<HTML><TITLE>Test</TITLE>\n");
>         printf("<BODY>Hello World !</BODY>");
> }
> 
> After compiled the file, I put it in cgi-bin but the script is not working.
> Why ?

You have to tell the http server what kind of file you want to print:

so the program should look like:
I've not tested it!

#include <stdio.h>

void main(void)
{
        printf("Content-type: text/html\n\n"); 
        /* the second \n is essential!! */

        printf("<HTML><TITLE>Test</TITLE>\n");
        printf("<BODY>Hello World !</BODY></html>");
};


Weasel                          mailto:palfrader@xxxxxxx.xxx
Peter                   http://www.cosy.sbg.ac.at/~ppalfrad/
------------------------------------------------------------
     We have full klingon console support just in case.
                         -- Alan Cox on linux-kernel