made the examples build without exception support. added overloads of add_torrent() and add_magnet_uri() that don't throw

This commit is contained in:
Arvid Norberg
2009-02-26 07:09:56 +00:00
parent f8e72650bd
commit 7aacfca292
14 changed files with 894 additions and 1017 deletions

View File

@@ -54,28 +54,28 @@ int main(int argc, char* argv[])
return 1;
}
#ifndef BOOST_NO_EXCEPTIONS
try
#endif
session s;
s.listen_on(std::make_pair(6881, 6889));
add_torrent_params p;
p.save_path = "./";
error_code ec;
p.ti = new torrent_info(argv[1], ec);
if (ec)
{
session s;
s.listen_on(std::make_pair(6881, 6889));
add_torrent_params p;
p.save_path = "./";
p.ti = new torrent_info(argv[1]);
s.add_torrent(p);
std::cout << ec.message() << std::endl;
return 1;
}
s.add_torrent(p, ec);
if (ec)
{
std::cerr << ec.message() << std::endl;
return 1;
}
// wait for the user to end
char a;
std::cin.unsetf(std::ios_base::skipws);
std::cin >> a;
}
#ifndef BOOST_NO_EXCEPTIONS
catch (std::exception& e)
{
std::cout << e.what() << "\n";
}
#endif
// wait for the user to end
char a;
std::cin.unsetf(std::ios_base::skipws);
std::cin >> a;
return 0;
}