diff options
Diffstat (limited to 'NorthstarDedicatedTest/logCompression.cpp')
-rw-r--r-- | NorthstarDedicatedTest/logCompression.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/NorthstarDedicatedTest/logCompression.cpp b/NorthstarDedicatedTest/logCompression.cpp index 5c170de3..d9e89fdf 100644 --- a/NorthstarDedicatedTest/logCompression.cpp +++ b/NorthstarDedicatedTest/logCompression.cpp @@ -17,6 +17,7 @@ using namespace std; bool compressFile(const fs::path path) { // read log file + ofstream output; string filename(path.string()); cout << "Compressing : '" + filename + "'" << endl; ifstream input(filename, ios_base::binary); @@ -30,13 +31,13 @@ bool compressFile(const fs::path path) // compress log file string compressed_data = gzip::compress(log_data.data(), log_data.size()); // write log file gzip - ofstream output(filename + ".gz", ios::out | ios::binary); - if (!output) + output.open(filename + ".gz"); + if (!output.is_open()) { cerr << "Could not write : '" + filename + "'" << endl; return false; } - output.write(compressed_data.c_str(), compressed_data.size()); + output << compressed_data; output.close(); // delete log file remove(path); |