I'm trying to convert some torrents into magnets using libtorrent.
I've read that in python you can use
info = libtorrent.torrent_info(sys.argv[1])
print "magnet:?xt=urn:btih:%s&dn=%s" % (info.info_hash(), info.name())
I've tried the following on C++
torrent_info ti(current_file.c_str(), ec);
printf("magnet:?xt=urn:btih:%s&dn=%s\n", ti.info_hash().to_string().c_str(), ti.name().c_str());
But the result is not a proper string (is binary) and cannot use the result.
Someone knows how to convert the hash of a torrent to something I can print?
Thanks a lot.