summaryrefslogtreecommitdiff
path: root/src/read_pak.cc
blob: c894442ca4e237aa2780fec50a1b68156b2ae520 (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
#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;
}