From 538236772ce6edde390079c32533c1e70cf8bdca Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 6 Oct 2017 14:26:44 +0200 Subject: Implement BASE64 decoding of locations given by dictionary index --- example.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'example.cc') diff --git a/example.cc b/example.cc index 26bf404..5af1975 100644 --- a/example.cc +++ b/example.cc @@ -1,4 +1,5 @@ #include "istream/stream.h" +#include "util/base64.h" #include #include @@ -6,12 +7,16 @@ 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(1453); + data.reserve(length); - stream.seekg(245808); - stream.read(const_cast(data.data()), 1453); + stream.seekg(offset); + stream.read(const_cast(data.data()), length); std::cout << data.c_str() << std::endl; } -- cgit v1.2.3