c++ - gzip read file succeed first time but fails the second time I call it -
i using boost gzip read zipped file. program runs fine when call first time. when call same function second time. fails. don't know why worked once. thanks!
void readcheckfile(const char* _checkname,queue<graphnode> &_q) { int _dep; int _val; graphnode currentnode; cout<<"hererererererer\n"; fstream _checkfile(_checkname, fstream::in | fstream::binary); cout<<"tthererererererer\n"; std::stringstream _data; boost::iostreams::filtering_streambuf<boost::iostreams::input> in; in.push(boost::iostreams::gzip_decompressor()); in.push(_checkfile); boost::iostreams::copy(in, _data); cout<<"aaaatthererererererer\n"; //fstream _checkfile; //_checkfile.open(_checkname,fstream::in); _data>>_dep; while(_data.good()) { currentnode.depth=(unsigned char)_dep; _data>>_val; currentnode.x=(unsigned char)_val; for(i=0;i<16;i++) { _data>>_val; currentnode.state[i]=(unsigned char)_val; } _q.push(currentnode); } _checkfile.close(); //exit(0); } when call twice terminal returns:
hererererererer tthererererererer aaaatthererererererer hererererererer tthererererererer libc++abi.dylib: terminate called throwing exception ===================================================================================== = bad termination of 1 of application processes = exit code: 6 = cleaning remaining processes = can ignore below cleanup messages =====================================================================================
Comments
Post a Comment