LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-01-2011, 09:06 AM   #1
jeanCarloMachado
LQ Newbie
 
Registered: Jul 2011
Location: Carlos Barbosa Brazil
Distribution: CentOS
Posts: 19

Rep: Reputation: 0
Programing Web with C++


Hello

Sorry by the, but it is possible to program C++ for Web?
like Php I did not find anything, if it is, it is viable?
Can you point me a literature about this?

Tanks.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 09-01-2011, 09:27 AM   #2
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
You just need to google C++ CGI.
http://en.wikipedia.org/wiki/Common_Gateway_Interface

Unless you're talking about making a HTTP/XML client, rather than server-side page generation as PHP is traditionally used.

Last edited by Proud; 09-01-2011 at 09:30 AM.
 
Old 09-01-2011, 09:36 AM   #3
Skyer
Member
 
Registered: Aug 2011
Posts: 113

Rep: Reputation: 6
Yes it is,
and Proud is absolutely right.
I just wanted to add that you can use any language (programming or scripting), which supports I/O operations in general. (AFAIK).


Skyer
 
Old 09-01-2011, 09:50 AM   #4
jeanCarloMachado
LQ Newbie
 
Registered: Jul 2011
Location: Carlos Barbosa Brazil
Distribution: CentOS
Posts: 19

Original Poster
Rep: Reputation: 0
Tanks by the answers
But it's useful to make a iterative web page just with C++ excluding PHP?
In the market it is done?

Att
 
Old 09-01-2011, 09:58 AM   #5
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Can you clarify what you mean by "an iterative web page"?
Adding output line by line? With no use of external resources such as databases or incorporating other HTML-producing server-side code?
For an example output of
Code:
<html>
  <body>
     <h1>Hello there!</h1>
  </body>
</html>
Something similar to the below C example?
Code:
#include <stdio.h>

int main()
{
  printf("Content-type: text/html\n\n");
  printf("<html>\n");
  printf("<body>\n");
  printf("<h1>Hello there!</h1>\n");
  printf("</body>\n");
  printf("</html>\n");
  return 0;
}
Taken from http://computer.howstuffworks.com/cgi3.htm

Whether it's done (that is to say, whether C++ is used) is down to what problem people are trying to solve and what options they have available. For simple dynamic pages using common web servers, things like Perl and PHP are used as they're well suited to the task and often ready to use/easy to set up. People might use C++ due to webserver limitations or performance, or interacting with unusual resources. Or for the sake of it.

Last edited by Proud; 09-01-2011 at 10:02 AM.
 
Old 09-01-2011, 10:13 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
It isn't completely clear whether you want to use C++ to generate HTML, or whether you want to implement an HTTP server. In either case, the answer is yes. Since C++ can read commandline arguments, environment variables, and stdin, and can write to stdout, it can be used to write CGI applications. As far as I know, it is not the usual way to implement CGI, but there is nothing to stop you from doing so. A primitive HTTP server can be written in about a hundred lines of C. There are numerous open source examples of this, covering a fairly broad spectrum of capabilities.
--- rod.
 
Old 09-01-2011, 10:24 AM   #7
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 392

Rep: Reputation: 55
Quote:
Originally Posted by jeanCarloMachado View Post
Hello

Sorry by the, but it is possible to program C++ for Web?
like Php I did not find anything, if it is, it is viable?
Can you point me a literature about this?

Tanks.
Here are few things you could look at:
Lyle.
 
Old 09-01-2011, 10:26 AM   #8
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
The only other interpretation I can think of is you want a webserver that's written in C++ and doesn't have support for any server-side languages. (Or none other than C++). You wouldn't be wanting to write it from scratch, but could understand and compile the code if your only available programmer/compiler handles C++ (perhaps for purposes of security & future fixes). But this seems an unlikely scenario.
 
Old 09-01-2011, 10:34 AM   #9
jeanCarloMachado
LQ Newbie
 
Registered: Jul 2011
Location: Carlos Barbosa Brazil
Distribution: CentOS
Posts: 19

Original Poster
Rep: Reputation: 0
Tanks by the answers
But it's useful to make a iterative web page just with C++ excluding PHP?
In the market it is done?

Att
 
Old 09-01-2011, 12:02 PM   #10
jeanCarloMachado
LQ Newbie
 
Registered: Jul 2011
Location: Carlos Barbosa Brazil
Distribution: CentOS
Posts: 19

Original Poster
Rep: Reputation: 0
Ok you answered my questions!!
I wanna know if it is possible to use C++ instead of PHP, to make normal WEB sites, but not like a HTTP server.
Tha is it!
Tanks all of you by the quick answers.
This forum is the BEST!!
 
Old 09-01-2011, 12:13 PM   #11
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,220

Rep: Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319Reputation: 5319
Facebook is doing it...

http://en.wikipedia.org/wiki/HipHop_(software)
 
Old 09-01-2011, 03:33 PM   #12
Skyer
Member
 
Registered: Aug 2011
Posts: 113

Rep: Reputation: 6
Well,
the usefulness of using C++ instead of PHP depends on the purpose of web page you want to make.

PHP has grown very close to the web platform over the years, so if you don't have to use low profile language (or are not very concerned about the performance), like C++, I don't think it's a useful idea.

Good luck with it.


Skyer

Last edited by Skyer; 09-01-2011 at 03:35 PM.
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell programing rsatyandra Linux - Newbie 3 07-22-2011 12:07 AM
C programing Eirik Linux - Software 2 01-23-2011 10:48 AM
How do C++ programing rahilmaknojia Programming 12 08-07-2008 08:25 AM
perl programing mobs99 Linux - Newbie 7 10-27-2007 10:36 AM
start programing munkie_poo Linux - Newbie 2 07-18-2004 11:31 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration