zipped output file

This commit is contained in:
Hieu Hoang 2012-05-11 12:18:02 +01:00
parent ebc33f63e9
commit 1b04b5544b
2 changed files with 7 additions and 7 deletions

View File

@ -49,9 +49,11 @@ OutputFileStream::~OutputFileStream()
bool OutputFileStream::Open(const std::string &filePath)
{
m_outFile = new ofstream(filePath.c_str(), ios_base::out | ios_base::binary);
if (m_outFile->fail()) {
return false;
}
if (filePath.size() > 3 && filePath.substr(filePath.size() - 3, 3) == ".gz")
{
if (filePath.size() > 3 && filePath.substr(filePath.size() - 3, 3) == ".gz") {
this->push(boost::iostreams::gzip_compressor());
m_isGZ = true;
}
@ -67,14 +69,12 @@ void OutputFileStream::Close()
return;
}
if (m_isGZ) {
this->pop();
}
this->pop(); // file
//this->close();
m_outFile->close();
delete m_outFile;
m_outFile = NULL;
return;
}

View File

@ -41,7 +41,7 @@ public:
OutputFileStream();
OutputFileStream(const std::string &filePath);
~OutputFileStream();
virtual ~OutputFileStream();
bool Open(const std::string &filePath);
void Close();