diff --git a/AMDiS/src/VtkWriter.cc b/AMDiS/src/VtkWriter.cc index 2153ae00fc8d8d19d1863e742b50259946ca9e01..7b997d58f33468aaf4cadd92a2818feebe1e6fab 100644 --- a/AMDiS/src/VtkWriter.cc +++ b/AMDiS/src/VtkWriter.cc @@ -29,16 +29,21 @@ namespace AMDiS { switch (compress) { case GZIP: file.push(boost::iostreams::gzip_compressor()); - file.push(boost::iostreams::file_descriptor_sink(name.append(".gz"))); + name.append(".gz"); break; case BZIP2: file.push(boost::iostreams::bzip2_compressor()); - file.push(boost::iostreams::file_descriptor_sink(name.append(".bz2"))); + name.append(".bz2"); break; default: - file.push(boost::iostreams::file_descriptor_sink(name)); 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); #else