summaryrefslogtreecommitdiff
path: root/fast/read_pak.cc
blob: c1cf761359aee66950565033cddd313e2dac3c19 (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]);
  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;
}