Click to See Complete Forum and Search --> : cgi scripting in c/c++?


enderl25
01-03-2003, 11:06 AM
could someone give me some insight on how to run a c/c++ program, from a cgi script. i would like to do all of this in c/c++ if possible. the program that i would like to execute is displayed below:

#include <stdio.h>
#include <fcntl.h>

char conType[] = "Content-Type: text/html\n\n";

char wbpgstart[]=
"<HTML>
<HEAD>
<FONT FACE=TAHOMA>
<TITLE>MAILING LIST</TITLE>
</HEAD>
<BODY>
<CENTER>
<BR>";

char thisText[]=
"<FONT FACE=TAHOMA COLOR=#6495ED SIZE=2><B>THIS IS A TEST!</FONT></B>";

char wbpgend[]=
"<BR>
</CENTER>
</BODY>
</HTML>";

int main()
{
printf("%s", conType);

printf(wbpgstart);

printf("%s", thisText);

printf(wbpgend);

return 0;
}

jeffmott
01-03-2003, 11:43 AM
If it is an Apache server you can create a .htaccess file in the directory you want to execute your programs in.

.htaccess
AddHandler cgi-script .cgi .pl .exe .dll

Otherwise, read your server's documentation or contact the administrator if they require you to configure it differently.