aboutsummaryrefslogtreecommitdiff
path: root/example.cc
blob: 5af19751fe69388aa47611c66ba941f3a5dc8bf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "istream/stream.h"
#include "util/base64.h"

#include <string>
#include <iostream>

int main() {
	dictzip::Istream stream("gcide.dict.dz");

	// Decode location of _Accession_
	const std::size_t offset = dictzip::base64_decode("8Aw");
	const std::size_t length = dictzip::base64_decode("Wt");

	// Print the GCIDE definition of _Accession_
	std::string data;
	data.reserve(length);

	stream.seekg(offset);
	stream.read(const_cast<char*>(data.data()), length);

	std::cout << data.c_str() << std::endl;
}