繁体   English   中英

gsoap linux c ++ / struct失败交付

[英]gsoap linux c++ / struct failure delivery

charint,返回值传递正确。

但是struct被传递失败。

服务器:

soapcpp2 -2 -SLix ...

客户:

wsdl2h -f -s -o ... ...
soapcpp2 -i -C ...

struct{
  char * value;
}USER_ITEM

服务器:

int Service::GetValue(struct USER_ITEM * item)
{
  item->value = new char[100];
  item->value = "example";
}

客户:

....
ns2__useritemresponse user;
proxy.Getvalue(user)
user.user_item->value  // user.user_item address is null;
....

窗户很好。 但不是在Linux c ++上。

与上述格式相同。

我需要单独的一组选项吗?

如果您怀疑零件,请提供帮助。

抱歉,我的英语说得不好。

谢谢阅读。

您不能使用赋值运算符复制char指针,这不是std :: string:

item->value = new char[100];
strcpy(item->value, "example");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM