当前位置: 技术问答>linux和unix
我的sprintf有错误,不知道什么问题。
来源: 互联网 发布时间:2016-03-20
本文导语: char *sqlstr=NULL; sprintf(sqlstr,"select * from %s where name='%s' and password='%s'","fwusers","uname","passwd"); 编译没有问题,运行显示段错误。 请问哪里出了问题。 | char *sqlstr=NULL; 这一句也太可怕了吧,...
char *sqlstr=NULL;
sprintf(sqlstr,"select * from %s where name='%s' and password='%s'","fwusers","uname","passwd");
编译没有问题,运行显示段错误。
请问哪里出了问题。
sprintf(sqlstr,"select * from %s where name='%s' and password='%s'","fwusers","uname","passwd");
编译没有问题,运行显示段错误。
请问哪里出了问题。
|
char *sqlstr=NULL; 这一句也太可怕了吧,你竟然要对一个NULL去赋值。。
sprintf(sqlstr,"select * from %s where name='%s' and password='%s'","fwusers","uname","passwd");
随便改个
char sqlstr[1024];
sprintf(sqlstr,"select * from %s where name='%s' and password='%s'","fwusers","uname","passwd");
sprintf(sqlstr,"select * from %s where name='%s' and password='%s'","fwusers","uname","passwd");
随便改个
char sqlstr[1024];
sprintf(sqlstr,"select * from %s where name='%s' and password='%s'","fwusers","uname","passwd");