From 129a22cfcc7651daa4b11ed52e7870249f6373a5 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Tue, 16 Sep 2014 10:23:14 +0100 Subject: spring cleaning --- src/read_pak.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/read_pak.cc (limited to 'src/read_pak.cc') diff --git a/src/read_pak.cc b/src/read_pak.cc new file mode 100644 index 0000000..c894442 --- /dev/null +++ b/src/read_pak.cc @@ -0,0 +1,26 @@ +#include +#include +#include + +using namespace std; + +int +main(int argc, char** argv) +{ + ifstream ifs(argv[1]); + msgpack::unpacker pac; + while(true) { + pac.reserve_buffer(32*1024); + size_t bytes = ifs.readsome(pac.buffer(), pac.buffer_capacity()); + pac.buffer_consumed(bytes); + msgpack::unpacked result; + while(pac.next(&result)) { + msgpack::object o = result.get(); + cout << o << endl; + } + if (!bytes) break; + } + + return 0; +} + -- cgit v1.2.3