如何将异常消息从gsoap发送到std::字符串?
How do I put the exception message from gsoap then send to a std::string?
我知道下面的代码可以打印异常,但是我如何将异常消息放入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()};
相关文章:
- 我可以重新分配/覆盖std::字符串吗
- 如何将这个std::字符串转换为std::基本字符串
- std::字符串与 PCWSTR 的对话
- 重载 std::字符串运算符+ 用于打印枚举名称
- 从std::字符串创建OssBitString
- std::字符串擦除以删除最后一个字母
- 如何使用 C++ 中的原语初始化类(如 std::字符串从 const char* 初始化)
- std::字符串串联操作
- 如何有效地将一个大std::字符串的一部分转换为float
- 转义std::字符串中的特殊字符
- 用C++替换std::字符串中的一个子字符串,但不能全部替换
- C++std::字符串流到常量字符*的转换
- 如何将std::字符串转换为不同的字符串类
- 对齐C++字符串类型问题 std::字符串到 TStr
- std::字符串到字符*而不切割字节
- 编写具有非ASCII数据的std ::字符串
- 将 Delphi 的字符串转换为 std::字符串用于C++
- std::字符串添加到字符*
- 字符* 和 std::字符串和常量字符*之间的转换
- 用指针访问std ::字符串中的元素