tzgss1990 发表于 2012-11-9 16:17:45

求助,Loadrunner中strcpy函数出错

我输入下面的代码:
Action{
char *p="how are you ?";  
    char name;
        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:54

不要用指针型,用数组型字符串

perterliu 发表于 2012-11-12 10:45:28

Action()
{
        char p="how are you ?";
        char name="ABCDEFGHIJKLMNOPQRS";
        //name="ABCDEFGHIJKLMNOPQRS";
        strcpy(name,p);
    lr_output_message("%s",name);

}
这样写试试

perterliu 发表于 2012-11-12 10:46:18

Action()
{
      char *p="how are you ?";
      char name="ABCDEFGHIJKLMNOPQRS";
      //name="ABCDEFGHIJKLMNOPQRS";
      strcpy(name,p);
    lr_output_message("%s",name);

}
或者这样

tzgss1990 发表于 2012-11-12 11:24:02

嗯,好的,谢谢各位的指导!
页: [1]
查看完整版本: 求助,Loadrunner中strcpy函数出错