如果文件位于子文件夹中,我打印文件的所有行都有问题。我正在使用提升。
#include <iostream>
#include <fstream>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#inlude <vector>
...
std::ifstream="files/dir/sample.gz"; // file is ok but no line is printed
std::ifstream="sample.gz"; // file is printed line by line
std::ifstream ifile(infilez, std::ios::in | std::ios_base::binary);
boost::iostreams::filtering_istream in;
in.push(boost::iostreams::gzip_decompressor());
in.push(ifile);
std::vector<std::string> strs;
boost::split(strs,line,boost::is_any_of("\t"));
std::string name,lines,content;
std::stringstream ss;
int cpt=0;
while( std::getline( in, line ).good() ){
std::cout << line << "\n" << content << std::endl;
}
....