51Testing软件测试论坛

标题: 求助,Loadrunner中strcpy函数出错 [打印本页]

作者: tzgss1990    时间: 2012-11-9 16:17
标题: 求助,Loadrunner中strcpy函数出错
我输入下面的代码:
Action{
char *p="how are you ?";  
    char name[30];
        name="ABCDEFGHIJKLMNOPQRS";  
        strcpy(name,p); //name改变为"how are you ? "  
        lr_output_message("%s",name);

        return 0;
}
可是报了下面的错误:
Action.c (91): illegal character `\0241'
Action.c (91): illegal character `\0241'
Action.c (93): operands of = have illegal types `array 30 of char' and `pointer to char'
Action.c (93): lvalue required
Action.c (93): illegal character `\0241'
Action.c (93): illegal character `\0241'
d:\\lounrunner wenjian\\cs_006\\\\combined_cs_006.c (5): 6 errors, not writing pre_cci.ci
求帮助!!!
作者: 云层    时间: 2012-11-9 19:17
不要用指针型,用数组型字符串
作者: perterliu    时间: 2012-11-12 10:45
Action()
{
        char p[15]="how are you ?";
        char name[30]="ABCDEFGHIJKLMNOPQRS";
        //name[30]="ABCDEFGHIJKLMNOPQRS";
        strcpy(name,p);
    lr_output_message("%s",name);

}
这样写试试
作者: perterliu    时间: 2012-11-12 10:46
Action()
{
        char *p="how are you ?";
        char name[30]="ABCDEFGHIJKLMNOPQRS";
        //name[30]="ABCDEFGHIJKLMNOPQRS";
        strcpy(name,p);
    lr_output_message("%s",name);

}
或者这样
作者: tzgss1990    时间: 2012-11-12 11:24
嗯,好的,谢谢各位的指导!




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2