blob: 81eed5df996588edf413c58da1aaf0343985a2cd (
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 <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;
}
}
|