I want to know if I can use C++ to allow for dynamic webpage creation, and stuff like that, similar to cgi and php scripts. I don't want to have to learn a new languge, if possible. And I do need to create interactive pages.
Thanks in advance
Printable View
I want to know if I can use C++ to allow for dynamic webpage creation, and stuff like that, similar to cgi and php scripts. I don't want to have to learn a new languge, if possible. And I do need to create interactive pages.
Thanks in advance
I believe it is possible to write CGI with C++. I dont really know much about though.
of course. but what you're talking about is basically writing a preprocesser like PHP that understands HTML, right? seems like learning a new language would be a lot easier - not to mention most servers out there aren't going to run just any executable on their machines...
you could, but if your going for easy then learning php or cgi would be the easier way
If it is possible to write cgi scripts using C++, I would do that. I'm just wondering, is cgi compiled? Otherwise, since my site is not self-hosted, it would not be certain that the server would run the compiled code.
cgi is not a language, it's a protocol.
Your php or Perl interpreter is a cgi program.
cgi programs (strictly speaking libraries of course as they run inside something else) can be created using pretty much anything.
C is the most commonly used language, but C++, Delphi, Python, and others, can also be used.
http://www.boutell.com/cgic/
Library for making CGI scripts in C, which might be used in C++ (Haven't tried)
if you're going to be using CGI anyway, I'd suggest learning PERL instead of trying to do it with C/C++ - You'll find that you don't want a compiled binary for every little errand you want done quickly
But computers are so fast anyway, (I'm using a iMac G5) would compiling really be a problem?
...you don't seem to get it...
First, you can't create a "script" with a compiled language, so the real answer to your original question is: no.
Second, I mean what if you want to open a file, remove timestamps, and then close the file. IMO, it's faster to write the code, then type "perl killstamps.pl" then write the code, wait for it to compile, then run it. It also makes things cleaner, because now you just have a script lying around. With C/C++, you have both the source and a compiled binary. Get rid of the source and you can't rebuild the binary. Get rid of the binary and you have to recompile the source.
They aren't CGI programs, they're just interpreters for PHP and Perl. Well, PHP is usually used as an Apache module.Quote:
Originally Posted by jwenting
CGI programs don't run inside anything else; they're just processes with stdin and stdout piped to certain places, with some environment variables set up certain ways.
This is a pretty good tutorial that explains low-level what's going on: http://www.cs.tut.fi/~jkorpela/forms/cgic.html