I am using this sample to prove myself that base64_from_binary and
binary_from_base64 can be used in my app. But I am having little problem
and not able to understand whats missing
Here is the sample
#include "boost/archive/iterators/base64_from_binary.hpp"
#include "boost/archive/iterators/binary_from_base64.hpp"
#include "boost/archive/iterators/transform_width.hpp"
#include <string>
#include <iostream>
using namespace std;
using namespace boost::archive::iterators;
typedef
base64_from_binary<
transform_width
base64_t;
typedef transform_width< binary_from_base64std::string::iterator, sizeof(char) * 8, 6
binary_t;
int main() { string str = "Hello, world!"; cout << str << endl; string enc(base64_t(str.begin()), base64_t(str.end())); // Problem here. It works when I specify "str.end()-1" instead of "str.end()" but I loose last character after decoding. cout << enc << endl; string dec(binary_t(enc.begin()), binary_t(enc.end())); cout << dec << endl; return 0; } Will appreciate any help. I tried std::copy as well and have same problem.