Bencode is is a fully featured, open source, c++ library used to encode and decode bencode data.
This project has been build for study purpose. I took help from here.
cd into bencode directory
make
It will build library intolib
directory.
Todo
int main( )
{
ifstream iFile;
iFile.open("sample1.torrent", std::ifstream::in);
nBencode::decode decoder;
shared_ptr<nBencode::CItem> pItem =
decoder.decodeFile(iFile);
//print bencode data in pretty format.
shared_ptr<nBencode::CPrintPretty> print(
new nBencode::CPrintPretty());
print->Print(pItem);
return 0;
}