Hi,
I am using boost::iostreams in a project that I am currently working on.
The relevant part of my code is shown below:
#include
#include
#include
...
void FileDataStore::write(DataSet *ds) {
filtering_ostream os;
// Check if we are writing a gzipped file
int iext = this->filename.find_last_of('.');
if (iext != std::string::npos && this->filename.substr(iext+1)
== "gz") {
os.push(gzip_compressor());
}
try {
os.push(file_descriptor_sink(this->filename));
} catch (std::ios_base::failure e) {
throw IOException() << errmsg_info((boost::format("Error
opening file '%s': %s") % this->filename %
strerror(errno)).str().c_str());
}
// Write my stuff to os
os.flush();
os.pop();
}
Basically, if the filename being used ends in .gz I want the file
written through a gzip filter so it is stored gzipped.
The problem is: if I unzip the resulting file using gzip I get a message
like this:
gzip: myfile.gz: decompression OK, trailing garbage ignored
The file content is OK but this message is annoying.
What am I doing wrong that causes this?
Many thanks,
Regards // Mike