Link to home
Start Free TrialLog in
Avatar of marc_adam
marc_adam

asked on

CGI with C/C++

How do you write CGI scripts in C/C++? I've looked all over the net, and everyone says that you can do it, but no one actually shows you how.  Could someone send me a small bit of source code that shows some text and a small graphic as examples.  Also, could you show me how to compile it and set it up on the web(what directories I'm allowed to put the file in)?  I'm running Win NT or Linux.  I'd prefer if you'd show me how to do it in Linux, though. Thankyou in advance,
Adam
Avatar of marc_adam
marc_adam

ASKER

Edited text of question.
Is there compelling reason that you want to do them in C?  

If you really must, there are some libraries that may help you.  I believe one is called cgicc:

http://www.gnu.org/software/cgicc
ASKER CERTIFIED SOLUTION
Avatar of stekman_
stekman_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forgot:

It's a bettter to use PHP, it's a lot like C/C++ but can be embedded in the pages. It also is a lot safer to use, as it's easy to create vunerable cgi-programs i C/C++ (tiny bug -> buffer overflow-> root-access -> site hacked...).

You find PHP on:

http://www.php.net/

/Stefan
I have written a huge site in C and think that there are some cases where it is by far the best language.  The real problem is that many web-managers do not allow C on their systems, having security concerns.

Certainly, if you need speed, and features not easily available in perl, C is tough to beat.