diff options
author | Patrick Simianer <p@simianer.de> | 2014-07-19 08:30:43 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-07-19 08:30:43 +0200 |
commit | f219bab21c07d02e7e54d557e23387bd93c9ce5f (patch) | |
tree | 14a6e2b647a3b1ab11391c154fbcf7c63841f8db /fast/read_pak.cc | |
parent | 6208c48407c359819945730006edf4c402b7ff77 (diff) |
hg io
Diffstat (limited to 'fast/read_pak.cc')
-rw-r--r-- | fast/read_pak.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fast/read_pak.cc b/fast/read_pak.cc new file mode 100644 index 0000000..81eed5d --- /dev/null +++ b/fast/read_pak.cc @@ -0,0 +1,26 @@ +#include <msgpack.hpp> +#include <iostream> +#include <fstream> + +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; + } +} |