C++ for web development?

Discussion in 'C++' started by Robert, Aug 19, 2004.

  1. Robert

    Robert Guest

    I was wondering if there was any web server which supported the use of
    c++ as a server side method for creating dynamic web pages. Is this
    viable, or should I just bite the bullet and learn a server-side
    scripting language like php?

    -- Thanks in advance
    Robert, Aug 19, 2004
    #1
    1. Advertising

  2. Robert

    Sam Holden Guest

    On Thu, 19 Aug 2004 05:22:52 GMT, Robert <> wrote:
    > I was wondering if there was any web server which supported the use of
    > c++ as a server side method for creating dynamic web pages. Is this
    > viable, or should I just bite the bullet and learn a server-side
    > scripting language like php?


    Almost all of them do.

    You can write a CGI program in almost any language. Which of course
    means it has nothing to do with the C++ language and hence is off
    topic, try:

    comp.infosystems.www.cgi


    --
    Sam Holden
    Sam Holden, Aug 19, 2004
    #2
    1. Advertising

  3. Robert

    David Hilsee Guest

    "Robert" <> wrote in message
    news:MOWUc.7747$...
    > I was wondering if there was any web server which supported the use of
    > c++ as a server side method for creating dynamic web pages. Is this
    > viable, or should I just bite the bullet and learn a server-side
    > scripting language like php?


    I'm sure that it is possible to write C++ CGI applications. I have seen C++
    CGI code, and there are libraries to aid in C++ CGI development (e.g.
    http://www.gnu.org/software/cgicc/cgicc.html). However, this is not a topic
    generally discussed in comp.lang.c++. I will say that higher-level
    languages like Java, Perl, Python, and PHP will probably provide more
    extensive web development libraries and a larger web development community
    due to their popularity amongst web developers.

    --
    David Hilsee
    David Hilsee, Aug 19, 2004
    #3
  4. Robert wrote:
    > I was wondering if there was any web server which supported the use of
    > c++ as a server side method for creating dynamic web pages. Is this
    > viable, or should I just bite the bullet and learn a server-side
    > scripting language like php?
    >


    -- Thanks in advance



    In the MS world you can do it with "ATL server" of IIS in this style:
    You create a class with methods and you assign each method a keyword
    called tag.


    Then in a SRF file (which is the ATL Server dynamic file) you write HTML
    and inside it you use those keywords, which are replaced with outputs of
    method calls when the page is called through a browser.


    An example. The C++ file:


    #include <ctime>

    class whatever
    {
    // ...
    public:

    [tag_name(name="GetDate")]
    HTTP_CODE OnGetDate()
    {
    using namespace std;

    time_t theTime;
    time(&theTime);

    m_HttpResponse<<ctime(&theTime);

    return HTTP_SUCCESS;
    }

    // ...
    };



    The SRF file:


    <html>
    <HEAD>
    </HEAD>

    <BODY>
    {{handler whatever.dll/Default}}

    <h2>Time Server</h2>
    The current date and time is: {{GetDate}}

    </BODY>
    </html>


    The {{GetDate}} above is replaced with the output passed to
    m_HttpResponse object.






    Regards,

    Ioannis Vranos

    http://www23.brinkster.com/noicys
    Ioannis Vranos, Aug 19, 2004
    #4
  5. Re: C++ for web development? [OT]

    "Robert" <> wrote in message
    news:MOWUc.7747$...
    > I was wondering if there was any web server which supported the use of
    > c++ as a server side method for creating dynamic web pages. Is this
    > viable, or should I just bite the bullet and learn a server-side
    > scripting language like php?


    I would strongly suggest giving PHP a shot - you'll see its easy to
    set-up, well supported, and takes little work to fulfill basic needs.
    Of course web applications can be written in C++,
    but it would be very much like hammering a screw.

    --
    http://ivan.vecerina.com/contact/?subject=NG_POST <- e-mail contact form
    Ivan Vecerina, Aug 19, 2004
    #5
  6. Robert <> spoke thus:

    > I was wondering if there was any web server which supported the use of
    > c++ as a server side method for creating dynamic web pages. Is this
    > viable, or should I just bite the bullet and learn a server-side
    > scripting language like php?


    <ot>It's certainly possible - all my company's dynamic web pages are
    handled by CGI's written in C++. Now whether that's preferable to a
    scripting language is another question altogether - my impression is
    that it isn't.</ot>

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
    Christopher Benson-Manica, Aug 19, 2004
    #6
  7. Robert

    Default User Guest

    Re: C++ for web development? [OT]

    Ivan Vecerina wrote:
    >
    > "Robert" <> wrote in message
    > news:MOWUc.7747$...
    > > I was wondering if there was any web server which supported the use of
    > > c++ as a server side method for creating dynamic web pages. Is this
    > > viable, or should I just bite the bullet and learn a server-side
    > > scripting language like php?

    >
    > I would strongly suggest giving PHP a shot - you'll see its easy to
    > set-up, well supported, and takes little work to fulfill basic needs.
    > Of course web applications can be written in C++,
    > but it would be very much like hammering a screw.



    That all depends. PHP is great and I use it for web developement, but it
    can be very slow if you have some intensive work for it to do, like
    search a bunch of files. Something that compiles to machine code, like C
    or C++ can be very useful in the right application. It's worthwhile
    knowing how to do both.

    In answer to the OP's question, CGI only requires that programs be able
    to access environment variables, read from standard in and write to
    standard out. C++ can do all of these. As others mentioned, there are
    prefab libraries out there to help out. Search for: C++ cgi



    Brian Rodenborn
    Default User, Aug 19, 2004
    #7
  8. Robert

    Don Kim Guest

    > In the MS world you can do it with "ATL server" of IIS in this style: You
    > create a class with methods and you assign each method a keyword called
    > tag.


    Don't forget also, that you can do traditional asp.net programming using
    managed c++ as the code behind. I would imagine this will be the case with
    the upcomming c++/cli, and will be even better since you can utilize much
    more natural c++ syntax.

    - Don Kim
    Don Kim, Aug 21, 2004
    #8
  9. Robert

    Guest

    Robert wrote:
    > I was wondering if there was any web server which supported the use of
    > c++ as a server side method for creating dynamic web pages. Is this
    > viable, or should I just bite the bullet and learn a server-side
    > scripting language like php?
    >
    > -- Thanks in advance


    If you intend to do C++ CGI in scripting language, C++ interpreter
    Ch has C++ CGI toolkit which provides ASP or JSP like APIs for
    CGI programming. You can download it for free use at
    http://www.softintegration.com/products/toolkit/cgi/

    You can stil use your favorite C++ language to write web applications.

    As for dynamic web page programming like PhP, the solution is still not
    there. But I heard that in the future, there might be a module called
    mod_ch for Apache that allows you to write server-side scirpting in C++.
    , Aug 21, 2004
    #9
  10. Robert

    Robert Guest

    Thank you for your suggestions everyone, and I'd like to apologize for
    the off-topic nature of my post. I didn't realize.
    Robert, Aug 22, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer
    Replies:
    2
    Views:
    429
    John Saunders
    Aug 6, 2003
  2. Akhlaq Khan
    Replies:
    4
    Views:
    748
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Sep 27, 2004
  3. Replies:
    0
    Views:
    462
  4. Replies:
    2
    Views:
    775
    dar7yl
    Jan 15, 2005
  5. Replies:
    5
    Views:
    941
    H. S. Lahman
    Jan 15, 2005
Loading...

Share This Page