调试 CGI+BOA的时候,出现cgi_header错误,啥意思啊?
我也是按照网上的知道手册步骤来的,能访问静态网页,但我测试CGI程序的时候,却提示:cgi_header:unable tofind LFLF,
这是什么什么意思? 谢谢!!! 是不是代码输出格式不对?! \n\n?
\r\n?
\n\r? 本帖最后由 雪中的紫诺 于 2012-05-08 00:23 编辑
tobealinuxer 发表于 2012-05-07 17:56 static/image/common/back.gif
是不是代码输出格式不对?!
# include <stdio.h>
# include <stdlib.h>
int main()
{
char *data;
longm,n;
printf("Content-Type:text/html \r\n\r\n");
printf("<html> <head>\n");
printf("<title> hello world</title> \n");
printf("</head>\n");
printf("<body> \n");
data = getenv("QUERY_STRING");
if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2)
printf("< P >错误!输入数据非法。表单中输入的必须是数字。</p>");
else
printf("< P >%ld和%ld的成绩是:%ld。",m,n,m*n);
printf("</body> </html> \n");
return 0;
}
我是才接触CGI+boa,我是在网上找的test程序,我把这程序在虚拟机上交叉编译,移植到ARM-linux板上。运行的时候,就提示上面的错误,我找其它的事例程序也是如此。我的项目的目的是想通过CGI+BOA方式,对arm-linux板上的xml文件进行配置。因为我程序里面调用xml配置文件里的参数。求指点思路!谢谢! 本帖最后由 雪中的紫诺 于 2012-05-08 00:24 编辑
T-Bagwell 发表于 2012-05-07 18:37 static/image/common/back.gif
\n\n?
\r\n?
\n\r?
高手,我测试的代码是:
# include <stdio.h>
# include <stdlib.h>
int main()
{
char *data;
longm,n;
printf("Content-Type:text/html \r\n\r\n");
printf("<html> <head>\n");
printf("<title> hello world</title> \n");
printf("</head>\n");
printf("<body> \n");
data = getenv("QUERY_STRING");
if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2)
printf("< P >错误!输入数据非法。表单中输入的必须是数字。</p>");
else
printf("< P >%ld和%ld的成绩是:%ld。",m,n,m*n);
printf("</body> </html> \n");
return 0;
}
这是我在网上找的事例,因为我是第一次接触,我的项目的目的是想通过CGI+BOA方式,对arm-linux板上的xml文件进行配置。因为我程序里面调用xml配置文件里的参数。请指点思路。谢谢! 最后多加些 printf("\r\n\r\n"); 本帖最后由 daniel_kohler 于 2012-05-25 13:18 编辑
回复 5# 雪中的紫诺
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *data;
longm = 0, n = 0;
printf("%s\n\n", "Content-Type:text/html;charset=gb2312");
printf("<html> <head>\n");
printf("<title> hello world</title> \n");
printf("</head>\n");
printf("<body> \n");
data = getenv("QUERY_STRING");
if(data != NULL){
if(sscanf(data,"m=%ld&n=%ld",&m,&n)!=2){
printf("< P >错误!输入数据非法。表单中输入的必须是数字。</p>");
}else{
printf("< P >%ld和%ld的成绩是:%ld。</p>",m,n,m*n);
}
}else{
printf("data is null");
}
printf("</body> </html> \n");
return 0;
}
daniel_kohler 发表于 2012-05-25 13:17 static/image/common/back.gif
回复 5# 雪中的紫诺
什么意思? 我的QQ297101000.希望能得到你的指点。
页:
[1]