Skip to content

zhouhaibing089/BEncode2JSON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##Bencode2json

This library is going to serve as a ultility for the project Link

###How to build

make libb2j.a

###How to use

Here is the code in the file test.cpp

#include <iostream>
#include <string>
#include "include/bencode2json.h"

int main() {
    std::string s;
    std::cin >> s;
    try {
    	std::cout << link::bencode2json(s) << std::endl;
	} catch (link::syntax_error e) {
		std::cout << "Syntax Error" << std::endl;
	}
    return 0;
}

Just as you see, the interface is very simple. When you open the included file include/bencode2json.h, you see the interface there:

namespace link {
	// exception
	struct syntax_error {};

	// convert functions
	std::string bencode2json(std::string bencodestr);
	std::string bencode2json(const char *bencodestr, int length);
}

So you see, a really simple interface and a really simple project.

About

A library to convert bencode to json string.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages