|
楼主 |
发表于 2004-12-26 22:48:42
|
显示全部楼层
如果数据包内容里面有这些特殊字符,因为数据包里面有很多字节是0,这样就会有问题。因此是不是必须用mysql_real_escape_string()函数?
还有一个问题请教,我的测试代码如下:
编译用gcc -o test test.c -lmysqlclient
编译没有错误,可运行test的时候出来错误提示为:
Segmentation fault
这个问题会是什么原因?谢谢回复
[code:1]
#include <stdio.h>
#include <mysql/mysql.h>
#include <string.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
MYSQL test;
char *srcstr="What's this";
char *tostr;
tostr = malloc(23);
mysql_real_escape_string(&test,tostr,srcstr,strlen(srcstr));
}
[/code:1] |
|