tmaklin/bxzstr

bxz::ofstream::close() produces a zero-byte file

tmaklin opened this issue · 0 comments

When run with the code

#include "bxzstr.hpp"
#include <iostream>

int main(int argc, char** argv){
    bxz::ofstream out("test.gz", bxz::z, 1);
    for(long long i = 0; i < 10; i++){
        out << i << "\n";
    }
    out.close();
}

closing the file will not write anything (test.gz will be zero bytes). Flushing the stream and then closing will perform the write but using either separately fails.