Base64Encoder/Decoder bug or incorrect use ?

Please post support and help requests here.
CaHbKa
Posts: 1
Joined: 11 Aug 2008, 12:16

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

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

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.



Return to “Support”

Who is online

Users browsing this forum: sanjal and 1 guest

cron