diff options
author | Patrick Simianer <p@simianer.de> | 2014-07-20 15:25:43 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-07-20 15:25:43 +0200 |
commit | 41046f6ac02a1d947d656d033ecb53a249e7cc7e (patch) | |
tree | c10bc1b555e7636e6f568e1926b01d111320d757 /util/read_pak.cc | |
parent | 08e9a6f71c80fc7327d1758312b40bd5ba763dc9 (diff) |
cleanup
Diffstat (limited to 'util/read_pak.cc')
-rw-r--r-- | util/read_pak.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/util/read_pak.cc b/util/read_pak.cc new file mode 100644 index 0000000..d4bff91 --- /dev/null +++ b/util/read_pak.cc @@ -0,0 +1,28 @@ +#include <iostream> +#include <fstream> +#include <msgpack.hpp> + +using namespace std; + + +int +main(int argc, char** argv) +{ + ifstream ifs(argv[1]); + size_t i = 0, nn, ne; + 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; +} + |