关于C++写CGI程序的简单问题
新手,望大虾指点,不胜感激!
我在iis里配置了发布根目录是E:\Interpub\wwwroot,并将我的html文件和CGI程序放入其中,可是每次点击按钮时,都出现“打开或保存”对话框,后来是flashget直接下载了。下面是具体代码:
Html文件:
<html>
<head>
<title>CAUC</title>
</head>
<body >
<table border="0" width="550" cellspacing="0" cellpadding="0" align="center" height="300">
<tr>
<form method="post" action="a.exe" name="tw">
<td width="100%" height="25" align="center">
<input type="text" name="word" size="55">
<input type="submit" value=" 点击" name="www">
</td>
<input type="hidden" name="cdtype" value="GB">
</form>
</tr>
</table>
</body>
</html>
CGI文件(a.cpp):
#include <ostream.h>
#include <fstream.h>
#include <stdio.h>
void bgein(const char * title)
{
cout<<"content-type:text/html \n\n"<<"<html><head><title>\n"<<title<<"\n</title></head><body>\n";
}
void end()
{
cout<<"</body></html>\n";
}
void main()
{
bgein("Hello word");
cout<<"<h1>Hello Word! </h1>";
end();
}
不知是什么原因,小弟在此谢过!