Greetings.
What I want to do is to feed an attachment chain with some
dynamic data I produce "by the fly". One way I can think of is dump
all to some file and then do something like:
FileSource fs("temp.file", true, new Gzip gz(new
FileSink("test.txt.gz")));
But I want to avoid any temporary files.
So, can I do it like this:
(I use crypto++ 5.1 with VC++ 6.0 on Win2k)
// main.cpp //
#include <files.h>
#include <gzip.h>
#include <iostream>
#include <string>
using namespace CryptoPP;
using namespace std;
int main()
{
string s1;
try
{
Gzip gz(new FileSink("test.txt.gz"));
do
{
cin >> s1;
//-- I'm not sure about this: --//
gz.Put(reinterpret_cast<const unsigned char *>(s1.c_str()),
s1.length());
}
while (s1 != "x");
gz.MessageEnd();
gz.MessageSeriesEnd();
}
catch(Exception const &e)
{
cout << e.what();
}
return 0;
}
--
"My software never has bugs. It just develops random features."