Commit 17738001 authored by Naumann, Andreas's avatar Naumann, Andreas
Browse files

boost::iostreams truncate bug

parent b9b2cc7b
...@@ -29,16 +29,21 @@ namespace AMDiS { ...@@ -29,16 +29,21 @@ namespace AMDiS {
switch (compress) { switch (compress) {
case GZIP: case GZIP:
file.push(boost::iostreams::gzip_compressor()); file.push(boost::iostreams::gzip_compressor());
file.push(boost::iostreams::file_descriptor_sink(name.append(".gz"))); name.append(".gz");
break; break;
case BZIP2: case BZIP2:
file.push(boost::iostreams::bzip2_compressor()); file.push(boost::iostreams::bzip2_compressor());
file.push(boost::iostreams::file_descriptor_sink(name.append(".bz2"))); name.append(".bz2");
break; break;
default: default:
file.push(boost::iostreams::file_descriptor_sink(name));
break; break;
} }
{
//boost::iostreams seems not to truncate the file
std::ofstream swapfile(name.c_str(), std::ios::out | std::ios::trunc);
swapfile.close();
}
file.push(boost::iostreams::file_descriptor_sink(name, std::ios::trunc));
writeFileToStream(file); writeFileToStream(file);
#else #else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment