请告诉我如何使用boost :: exception正确使用try/catch.
这是一个例子
void Settings::init(const std::string &filename)
{
using boost::property_tree::ptree;
try
{
read_xml(filename, pt);
}
catch(boost::exception const& ex)
{
LOG_FATAL("Can't init settings. %s", /* here is the question */);
}
}
Run Code Online (Sandbox Code Playgroud)
我是否也需要catch std :: exception?我不能让我的应用程序失败,所以我只需要记录所有内容.
UPD: 我现在也无法理解从异常中检索记录的信息???
我有一个字符串,例如“ ???????????” 并寻找一种将其转换为url编码的win1251字符串的方法%F5%EE%EB%EE%E4%E8%EB%FC%ED%E8%EA
我在这里找到utf8_to_win1251函数在javascript中将对话UTF-8编码为1251
但
utf8_decode("???????????") = "õîëîäèëüíèê"
encodeURIComponent("õîëîäèëüíèê") =
"%C3%B5%C3%AE%C3%AB%C3%AE%C3%A4%C3%A8%C3%AB%C3%BC%C3%AD%C3%A8%C3%AA"
Run Code Online (Sandbox Code Playgroud)
这不是 %F5%EE%EB%EE%E4%E8%EB%FC%ED%E8%EA
我已经在Google上搜索了很多,但是什么也没找到。