linux中C程序出现Segmentation fault。。。
如题:linux中C程序出现Segmentation fault。
使用C写了一个CGI ……
但是在编译的时在 char *DATA = getenv("QUERY_STRING"); 有警告:
warning:assignment makes pointer from integer without a cast
部分源程序:
#include <stdio.h> // 只有这一个头文件
char username[20]; // 放用户名
char password[20]; // 放密码
char *DATA = getenv("QUERY_STRING"); // 取得CGI输入,POST方式
if( DATA == NULL ){return 0;} // 看指针是否有效
sscanf(DATA, "username=%s&password=%d",&username,&password); // 取出username和password
再往下是比较字符传
………………
………………
………………
我已经试过 char *DATA =(char*)getenv("QUERY_STRING");
编译时不显示警告了,但是运行时还会 Segmentation fault
也试过 sscanf(getenv("QUERY_STRING"),"username=%s&password=%d",&username,&password);
但是也不行
应该不是类型转换的问题,
大家快来帮我看看啊……
谢谢啦!!!
VPC2007中的RedHat9.0,内核2.4.20-8
sscanf(DATA, "username=%s&password=%d",username,password);
很难控制,
sscanf支持 正则 表达式.
相关问答:
请问用C或C++如何编写求解3D魔方的程序,该从何开始?
谢谢各位,帮忙提点建议吧。
http://www.mofang.net/code/176/182/6581.html
我只能突破60秒!唉。
我刚过40秒
google的android中有个OpenGL ES + ......
#include"stdio.h"
#include"stdlib.h"
void ContrTwo(char i)
{
char str1[8];
itoa(i,str1,2);
printf("%s",str1);
}
unsigned char leftRot(char str,int i);
unsign ......
本人在项目中,用ssh架构,想做成分页的效果.
以前我在页面中是,这样取得数据的
<!--进行循环遍历数据-->
<!--进行循环遍历数据-->
<%
List<Users> lof = (List) request.getAttri ......
两个文件1.PC,1.inc
1.PC有操作oracle数据库的 ,1.inc也有操作oracle数据库
在其他数据中如informix 中$include 1.inc就可以使用了
在ORACLE数据库重 $include 1.inc不可用 EXEC SQL include 1.inc也不可 ......