title: How can I read line-by-line using Boost IOStreams' interface for Gzip files?
body: <p>I managed to integrate the boost Iostream APIs for reading zipped files. I followed the documentation in boost page and have the following code so-far: </p>
  
  <pre><code>std::stringstream outStr;  
  ifstream file("file.gz", ios_base::in | ios_base::binary);  
  try {  
      boost::iostreams::filtering_istreambuf in;  
      in.push(boost::iostreams::gzip_decompressor());  
      in.push(file);  
      boost::iostreams::copy(in, outStr);  
  }  
  catch(const boost::iostreams::gzip_error&amp; exception) {  
      int error = exception.error();  
      if (error == boost::iostreams::gzip::zlib_error) {  
         //check for all error code    
      }   
  }  
  </code></pre>
  
  <p>The code works fine (so please ignore any typos. and errors above :)).   </p>
  
  <ol>
  <li>Looks like the above code will read the complete the file and store it in the memory while creating the filtering_istreambuf. Is that true, from my investigation it looks so to me? If the file is read into memory, this code can be an issue for large files (which is what I'm dealing with).  </li>
  <li>My current code reads the gzipped using gzgets API from zlib line by line. Is there a way to do line by line reading using boost APIs? </li>
  </ol>