 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Peter Morris Guest
|
Posted: Thu Jul 10, 2003 6:11 pm Post subject: HTML |
|
|
Is it possible to use C or C++ to create web pages?
Ouputting text with HTML syntax is easy enough,
but how do I make a web browser see the generated
text?
|
|
| Back to top |
|
 |
MiniDisc_2k2 Guest
|
Posted: Thu Jul 10, 2003 6:15 pm Post subject: Re: HTML |
|
|
"Peter Morris" <nospam.ple (AT) se (DOT) com> wrote
| Quote: | Is it possible to use C or C++ to create web pages?
Ouputting text with HTML syntax is easy enough,
but how do I make a web browser see the generated
text?
|
Sorry about the os-dependent reply, but this question is kind of
os-dependent (OP, please, next time, try to place this in a better
newsgroup). Just because I'm feeling nice:
(Assuming windows)
#include <fstream>
#include <stdlib.h>
int main()
{
using namespace std;
/* Output to text file the HTML stuff here */
system("iexplore <filename>");
}
Obviously, replace <filename> with whatever file you sent it to. This should
open up internet explorer to view the newly created file. Note that you need
to output this code to a file with a .htm or .html extention!
--
MiniDisC_2k2
To reply, replacenospam.com with cox dot net.
|
|
| Back to top |
|
 |
Michael Furman Guest
|
Posted: Thu Jul 10, 2003 6:52 pm Post subject: Re: HTML |
|
|
"Peter Morris" <nospam.ple (AT) se (DOT) com> wrote
| Quote: | Is it possible to use C or C++ to create web pages?
Ouputting text with HTML syntax is easy enough,
but how do I make a web browser see the generated
text?
|
Just output it in the file and then start browser and tell it to read this
file.
Michael Furman
|
|
| Back to top |
|
 |
Peter Morris Guest
|
Posted: Thu Jul 10, 2003 7:35 pm Post subject: Re: HTML |
|
|
"Michael Furman" <MichaelFurman (AT) Yahoo (DOT) com> wrote
| Quote: |
"Peter Morris" <nospam.ple (AT) se (DOT) com> wrote in message
news:beka8g$hf9$1 (AT) sparta (DOT) btinternet.com...
Is it possible to use C or C++ to create web pages?
Ouputting text with HTML syntax is easy enough,
but how do I make a web browser see the generated
text?
Just output it in the file and then start browser and tell it to read this
file.
Michael Furman
|
If that's all I wanted, I could just write the HTML file myself.
In Perl, for instance, I can write a script that outputs HTML.
If I run the script, it outputs the text to the screen. But I
can point Internet Explorer at the script, and it displays
a web page. This is dynamically generated, it varies according
to data read from a database.
I've written an application in perl, but I want to port it to
C++ or similar, using a complied executable instead of a
Perl script.
|
|
| Back to top |
|
 |
Russell Hanneken Guest
|
Posted: Thu Jul 10, 2003 8:13 pm Post subject: Re: HTML |
|
|
"Peter Morris" <nospam.ple (AT) se (DOT) com> wrote
| Quote: |
"Michael Furman" <MichaelFurman (AT) Yahoo (DOT) com> wrote in message
news:bekcm5$629us$1 (AT) ID-122417 (DOT) news.uni-berlin.de...
"Peter Morris" <nospam.ple (AT) se (DOT) com> wrote in message
news:beka8g$hf9$1 (AT) sparta (DOT) btinternet.com...
Is it possible to use C or C++ to create web pages?
Ouputting text with HTML syntax is easy enough,
but how do I make a web browser see the generated
text?
Just output it in the file and then start browser and tell it to read
this file.
If that's all I wanted, I could just write the HTML file myself.
In Perl, for instance, I can write a script that outputs HTML.
If I run the script, it outputs the text to the screen. But I
can point Internet Explorer at the script, and it displays
a web page. This is dynamically generated, it varies according
to data read from a database.
|
I don't know how you've configured things, but that doesn't work for me
unless I access the Perl script through a web server. Is that what you're
getting at? You want your web server to run a C++ program and serve the
output to a web browser? If so, then it's just an issue of configuring your
web server. But that's off-topic here.
| Quote: | I've written an application in perl, but I want to port it to
C++ or similar, using a complied executable instead of a
Perl script.
|
FYI, if you're processing GET/POST requests, you might find this C++ CGI
library helpful:
http://www.cgicc.org/
You'll probably want to use some other non-standard library for accessing
your database.
In any case, it sounds like another newsgroup would be more helpful to you.
comp.infosystems.www.authoring.cgi, maybe.
--
Russell Hanneken
[email]rhanneken (AT) pobox (DOT) com[/email]
|
|
| Back to top |
|
 |
Arthur J. O'Dwyer Guest
|
Posted: Thu Jul 10, 2003 8:42 pm Post subject: [OT] Re: HTML |
|
|
On Thu, 10 Jul 2003, Peter Morris wrote:
| Quote: |
"Peter Morris" <nospam.ple (AT) se (DOT) com> wrote in message
Is it possible to use C or C++ to create web pages?
If that's all I wanted, I could just write the HTML file myself.
In Perl, for instance, I can write a script that outputs HTML.
If I run the script
|
via a CGI-BIN server or similar, I presume?
| Quote: | it outputs the text to the screen. But I
can point Internet Explorer at the script, and it displays
a web page. This is dynamically generated, it varies according
to data read from a database.
|
Depends on what support your host has for CGI. Geocities, for example,
doesn't have any. Point IE at a Perl script hosted there, and you
get a screenful of line noise. (Perl source, that is.) The same thing
happens if I point IE at a Perl script on my hard disk, although if
you have it configured differently, I've no doubt you could get a "CGI
server" on your own machine. I'd kind of like that. :)
| Quote: | I've written an application in perl, but I want to port it to
C++ or similar, using a complied executable instead of a
Perl script.
|
Look up the Perl equivalent of 'system()'. Then compile your C++
program to an executable (for whatever OS is running on your host
machine), and exec that program via a Perl script. Completely
untested and OT stuff follows:
% cat hello.cc
#include <iostream>
int main()
{ std::cout << "Hello world!" << std::endl; return 0; }
% cat hello.cgi
#!/usr/bin/perl
print "Content-type: text/htmlnn";
print `./hello`; ## Note the backquotes!
% g++ -o hello hello.cc
% chmod 755 hello.cgi
HTH,
-Arthur
|
|
| Back to top |
|
 |
one2001boy@yahoo.com Guest
|
Posted: Sat Aug 02, 2003 7:09 am Post subject: Re: HTML |
|
|
Peter Morris wrote:
| Quote: | Is it possible to use C or C++ to create web pages?
|
of course, there is a cross platform C++ CGI toolkit
runs in C/C++ interpreter Ch.
http://www.softintegration.com/products/toolkit/cgi/
To access database, you write ODBC code which can
be used for any database in any OS.
ODBC information can be found in Microsoft MSDN, or
http://www.softintegration.com/products/toolkit/odbc/
| Quote: |
Ouputting text with HTML syntax is easy enough,
but how do I make a web browser see the generated
text?
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|