title: How to compress a file (gzip) using boost libraries in C++
body: <p>Im trying to compress a file using boost library (gzip).
  Its a simple task: lets suppose i have the file <strong>data.xml</strong> and I need to compress it to <strong>data.xml.gz</strong>. I can even use the default compression values, doesn't matter.</p>
  
  <p>I tryed to look up in google and BOOST pages but with no success.</p>
  
  <p>I have the following:</p>
  
  <pre><code>bool SyncFrequencyHistory::frequencyHistoryCompressFile(void)
  {
      printf("\r\n===== ACTION: frequencyHistoryCompressFile =====\r\n");
  
      std::ifstream inStream(FREQUENCY_HISTORY_FILE, std::ios_base::in);
      std::ofstream outStream(FREQUENCY_HISTORY_FILE_GZIP, std::ios_base::out);
      boost::iostreams::filtering_streambuf&lt;boost::iostreams::output&gt; out;
      out.push(boost::iostreams::gzip_compressor());
      out.push(outStream);
      boost::iostreams::copy(in, out);
  
      return true;
  }
  </code></pre>
  
  <p>FREQUENCY_HISTORY_FILE have the full location of the XML file</p>
  
  <p>FREQUENCY_HISTORY_FILE_GZIP have the full location for the XML.GZ file</p>
  
  <p>I know almost all code is wrong, but i have no idea who to write it the correct way.</p>