Overview
Features
Download
Documentation
Community
Add-Ons & Services

Base64Encoder/Decoder bug or incorrect use ?

Please post support and help requests here.

Base64Encoder/Decoder bug or incorrect use ?

Postby CaHbKa » 11 Aug 2008, 16:45

Code: Select all
std::stringstream istr(std::string("test"));
std::stringstream ostr;
std::stringstream mstr;

// trying to encode
Base64Encoder encoder(ostr);
StreamCopier::copyStream(istr, encoder);

// here we will see "dGVz"
std::cout << ostr.str() << std::endl;

// trying to decode
Base64Decoder decoder(ostr);
StreamCopier::copyStream(decoder, mstr);

// and now we see: "tes"
std::cout << mstr.str() << std::endl;


Is this is a bug or incorrect use of ?
Thanks
CaHbKa
 
Posts: 1
Joined: 11 Aug 2008, 12:16

Re: Base64Encoder/Decoder bug or incorrect use ?

Postby guenter » 11 Aug 2008, 21:56

Incorrect use in this case.
Put the statement
Code: Select all

encoder.close();


immediately after the copyStream line.

guenter
 
Posts: 1153
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests