如何将异常消息从gsoap发送到std::字符串?

How do I put the exception message from gsoap then send to a std::string?

本文关键字:std 字符串 gsoap 异常 消息      更新时间:2023-10-16

我知道下面的代码可以打印异常,但是我如何将异常消息放入std::string呢?

下面的代码输出异常
    proxy.soap_stream_fault(std::cout);

soap_stream_fault取任意std::ostream&,根据其原型。只需创建一个stringstream(或ostringstream)。这可能会做到:

std::stringstream strstream;
proxy.soap_stream_fault(strstream);
std::string str{strstream.str()};