LR运行报错memory violation : Exception ACCESS_VIOLATION received,跪求指导
代码执行到getstr(lr_eval_string ("{newstr}"),*p);这个函数之后就报错 Action.c(36): Error: C interpreter run time error: Action.c (36):Error -- memory violation : Exception ACCESS_VIOLATION received. 定位出问题的代码是*dest=*str; 求各位大神指导,这样的报错是怎么回事?要怎么修改呢?Action()
{
int i,len;
char *p;
p=(char *)calloc(1000,sizeof(char));
// web_set_max_html_param_len("4096");
web_reg_save_param("str",
"LB=onclick=\"atarget(this)\" class=\"s xst\">",
"RB= class=\"xi2\">0</a>",
"Ord=all",
LAST);
web_url("host","URL=http://bs.testroad.org/forum-15-2.html",LAST);
len=lr_paramarr_len("str");
lr_output_message ("%d",len);
for (i=1;i<=len;i++) {
lr_save_string(lr_paramarr_idx("str",i),"newstr");
getstr(lr_eval_string ("{newstr}"),*p);
lr_output_message ("帖子标题为:%s",p);
}
free(p);
return 0;
}
char * getstr(char * str,char * dest){
int i,len;
len=strlen(str);
// lr_output_message ("%s%s",*str,*dest);
for (i=0;i<len;i++) {
if (*str!='<') {
*dest=*str;
str++;
dest++;
}else{
break;
}
}
// while (*str!='<') {
// *dest=*str;
// str++;
// dest++;
// }
*dest='\0';
return dest;
}
页:
[1]