
I want to read line by line from a gzipped document.
I first do:
std::ifstream file(fileName.c_str()); boost::iostreams::filtering_streambufboost::iostreams::input in; in.push(boost::iostreams::gzip_decompressor()); in.push(documentFile);
However, then the obvious:
string line; while(std::getline(in, line)) { ... }
does not compile.
Is there really no getline for filtering_streambuf?
getline() is provided by the C++ standard library for use with input streams. The above should compile if you use filtering_stream instead of filtering_streambuf (and possibly make some unrelated changes -- e.g., it doesn't look like "documentFile" is defined).
Thanks for the clarification: when switching from filtering_streambuf to filtering_stream it indeed compiles. However, getline(in, line) then gives the *compressed* lines, despite the in.push(boost::iostreams::gzip_decompressor()); I don't understand why and how that is happening, any ideas? Holger PS: The "documentFile" in my example code should be "file", that was just a copy&paste error.