nqk 发表于 2010-1-29 13:54:24

memory violation : Exception ACCESS_VIOLATION received.

大家好,

我是学压力测试初学者, 我的代码出现下面的错误, 请帮我看看什么问题, 谢谢

代码:
string1 ="URL=http://192.168.0.5:6005/eos-default/common/skins/outlook/com.fhd.questionanswer.queTargetAnswerIframe.flow?operatorrisksid=";
string2 = "&questsetid=";
string3 = "&targetid=";
string4 = "&current=0&isFirst=true&isLast=true&targetTypeName=%E9%A3%8E%E9%99%A9&viewType=1&isCurrentLast=false";        

operatorrisksidv = lr_eval_string("{operatorrisksid}");
questsetidv = lr_eval_string("{questsetid}");
targetidv = lr_eval_string("{targetid}");

lr_output_message ("operatorrisksidv is %s", operatorrisksidv);
lr_output_message ("questsetidv is %s", questsetidv);
lr_output_message ("targetidv is %s", targetidv);

strcat(string1, operatorrisksidv);
strcat(string1, string2);
strcat(string1, questsetidv);
strcat(string1, string3);
strcat(string1, targetidv);
strcat(string1, string4);

lr_output_message ("Full path of file is %s", string1);

错误:
Action.c(362): Error: C interpreter run time error: Action.c (362):Error -- memory violation : Exception ACCESS_VIOLATION received.
Action.c(362): Notify: CCI trace: Action.c(362): strcat(0x01e44f76 "URL=http://192.168.0.5:6005/eos-default/...", 0x01746ec8 "UGBUKBZVJLAXBBRJXZOODMKJGHEQTPNX")
.
Action.c(362): Notify: CCI trace: Compiled_code(0): Action()

nqk 发表于 2010-1-29 14:24:57

解决:


       operatorrisksidv = lr_eval_string("{operatorrisksid}");
       questsetidv = lr_eval_string("{questsetid}");
       targetidv = lr_eval_string("{targetid}");

       

       lr_output_message ("string1 is %s", string1);
       lr_output_message ("string2 is %s", string2);
       lr_output_message ("string3 is %s", string4);
       lr_output_message ("string4 is %s", string4);

       
       URLAddress = (char *)malloc(strlen(string1)+strlen(operatorrisksidv)+strlen(string2)+strlen(questsetidv)+strlen(string3)+strlen(targetidv)+strlen(string4)+1) ;

    strcat(URLAddress, string1);
        strcat(URLAddress, operatorrisksidv);
       lr_output_message ("Full path of file is %s", string1);
        strcat(URLAddress, string2);
        strcat(URLAddress, questsetidv);
        strcat(URLAddress, string3);
        strcat(URLAddress, targetidv);
        strcat(URLAddress, string4);


    lr_output_message ("Full path of file is %s", URLAddress);
页: [1]
查看完整版本: memory violation : Exception ACCESS_VIOLATION received.