用于Web开发的C ++? [英] C++ for web development?

查看:77
本文介绍了用于Web开发的C ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何Web服务器支持使用

c ++作为创建动态网页的服务器端方法。这是否可行,或者我应该咬紧牙关并学习服务器端

脚本语言如php?


- 提前致谢

解决方案

2004年8月19日星期四05:22:52 GMT,Robert< gr ***** @ REMOVEhotmail .COM>写道:

我想知道是否有任何支持使用
c ++作为服务器端方法创建动态网页的Web服务器。这是否可行,或者我应该咬紧牙关并学习服务器端的脚本语言,如php?




几乎所有这些$

你几乎可以用任何语言编写CGI程序。其中当然

意味着它与C ++语言无关,因此关闭了

主题,试试:


comp .infosystems。 www.cgi

-

Sam Holden


" Robert" < GR ***** @ REMOVEhotmail.com>在留言中写道

新闻:MO **************** @ bignews1.bellsouth.net ...

我在想如果有任何Web服务器支持使用
c ++作为服务器端方法来创建动态网页。这是否可行,或者我应该咬紧牙关学习像php一样的服务器端脚本语言?




我是确保可以编写C ++ CGI应用程序。我见过C ++

CGI代码,还有一些库可以帮助C ++ CGI开发(例如
http://www.gnu.org/software/cgicc/cgicc.html) 。但是,这不是comp.lang.c ++中一般讨论的主题

。我会说更高级别的语言,如Java,Perl,Python和PHP,可能会提供更多的b $ b b广泛的Web开发库和更大的Web开发社区

由于他们在网络开发者中的受欢迎程度。


-

David Hilsee


< blockquote> Robert写道:

我想知道是否有任何支持使用
c ++作为服务器端方法创建动态网页的Web服务器。这是否可行,或者我应该咬紧牙关学习像php一样的服务器端脚本语言?




- 谢谢提前


在MS世界中,您可以使用ATL服务器进行操作。这种风格的IIS:

您创建一个包含方法的类,并为每个方法分配一个关键字

名为tag。

然后在SRF中您编写HTML

的文件(这是ATL Server动态文件),在其中使用这些关键字,当调用页面时,这些关键字将替换为

方法调用的输出通过浏览器。

一个例子。 C ++文件:

#include< ctime>


类什么

{

/ / ...

public:


[tag_name(name =" GetDate")]

HTTP_CODE OnGetDate()

{

使用命名空间std;


time_t theTime;

time(& theTime);


m_HttpResponse<<< ctime(& theTime);


返回HTTP_SUCCESS;

}


// ...

};


SRF文件:

< html>

< HEAD>

< / HEAD>


< BODY>

{{handler whatever.dll /默认}}


< h2>时间服务器< / h2>

当前日期和时间是:{{ GetDate}}


< / BODY>

< / html>

上面的{{GetDate}}已被替换输出传递给

m_HttpResponse对象。


问候,


Ioannis Vranos

http://www23.brinkster.com/noicys

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

解决方案

On Thu, 19 Aug 2004 05:22:52 GMT, Robert <gr*****@REMOVEhotmail.com> 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


"Robert" <gr*****@REMOVEhotmail.com> wrote in message
news:MO****************@bignews1.bellsouth.net...

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


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


这篇关于用于Web开发的C ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆