Hello all,
I’m switching one of my projects over from java to c++. Basically it’s a gzip file reader, where I’d like to parse a bunch of numbers (floats, ints, doubles)
and in some instances I’d like to skip some of the data. I’m a “noob” to boost and after getting the file reader working using the boost like this:
{
....
std::ifstream ormodelFile(filenameForTimeStep.c_str(),
std::ios_base::in|std::ios_base::binary);
boost::iostreams::filtering_istreambuf compressedFileFilter;
compressedFileFilter.push(boost::iostreams::gzip_decompressor());
compressedFileFilter.push(ormodelFile);
this->inputFile.rdbuf(&compressedFileFilter); //where inputFile is a an istream.
...
//do the file reading
}
I tried to add the skipping parts to the code by simply calling:
{
...
double value;
this->inputFile->seekg(sizeof(double),ios::cur);
...
}
the fail bit is set on the inputFile istream. Is it possible to do this using boost? I’m pretty “green” with boost so I’m sure it’s just my misunderstanding of how to use the lib but I couldn’t find my way around the docs to well.
The best I could find was that I need to somehow make my stream “seekable” but it wasn’t too clear to me how to do this.
Any help would be greatly appreciated.
Gerrick