- 论坛徽章:
- 0
|
#if 1
#define SERVER_NAME cgiServerName
#endif
#if 0
#define SERVER_NAME "www.boutell.com"
#endif
#ifdef WIN32
#define SAVED_ENVIRONMENT "c:\\cgicsave.env"
#else
#define SAVED_ENVIRONMENT "/tmp/cgicsave.env"
#endif /* WIN32 */
#include <stdio.h>
#include "cgic.h"
#include <string.h>
#include <stdlib.h>
void LoadEnvironment();
int cgiMain() {
#ifdef DEBUG
LoadEnvironment();
#endif /* DEBUG */
if (cgiFormSubmitClicked("loadenvironment") == cgiFormSuccess) {
LoadEnvironment();
}
cgiHeaderContentType("text/html");
/* Top of the page */
fprintf(cgiOut, "<HTML><HEAD>\n");
fprintf(cgiOut, "<TITLE>cgic test</TITLE></HEAD>\n");
fprintf(cgiOut, "<BODY><H1>cgic test</H1>\n");
if ((cgiFormSubmitClicked("testcgic") == cgiFormSuccess) ||
cgiFormSubmitClicked("saveenvironment") == cgiFormSuccess)
{
fprintf(cgiOut,"Content-type: image/gif\r\n");
fprintf(cgiOut,"Content-disposition: inline; filename=apache.gif\r\n\r\n");
fprintf(cgiOut,"name:apache.gif");
fprintf(cgiOut, "<hr>\n");
}
/* Now show the form */
/* Finish up the page */
fprintf(cgiOut, "</BODY></HTML>\n");
return 0;
}
这是cgic205 cgitest.c中的部分代码,我改了改我只是想先显示一个<TITLE>cgic test</TITLE>再显示一行〈H1>cgic test</H1>
完了是:
fprintf(cgiOut,"Content-type: image/gif\r\n");
fprintf(cgiOut,"Content-disposition: inline; filename=apache.gif\r\n\r\n");
fprintf(cgiOut,"name:apache.gif");
fprintf(cgiOut, "<hr>\n");
编译通过了,结果运行就显示了<TITLE>cgic test</TITLE>别的什么也没有
哪位老大告诉我怎样在cgi脚本中同时输出文本和图片呢?
或着图片文本交替输出
我始终没搞明白怎样用c语言使用cgic库写程序输出图片
我就是想在网页中通过cgi脚本输出文本和图片
还有就是mime头在一个网页输出中能使用两次吗比如:
Content-type: text/html\n\n
html代码。。。
Content-type: image/gif\n\n
html代码。。。。
能象这样使用吗?
[ 本帖最后由 fuer 于 2006-7-22 13:08 编辑 ] |
|