summaryrefslogtreecommitdiff
path: root/util/read_pak.cc
blob: afd6e6a415a077d81d228006214767e3a7e8f0c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <fstream>
#include <msgpack.hpp>

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;
}