40 using std::ostringstream ;
62 gzFile gsrc = gzopen( src.c_str(),
"rb" ) ;
65 string err =
"Could not open the compressed file " + src ;
69 FILE *dest = fopen( target.c_str(),
"wb" ) ;
72 char *serr = strerror( errno ) ;
73 string err =
"Unable to create the uncompressed file "
81 err.append(
"unknown error occurred" ) ;
92 int bytes_read = gzread( gsrc, in,
CHUNK ) ;
99 int bytes_written = fwrite( in, 1, bytes_read, dest) ;
100 if( bytes_written < bytes_read )
103 strm <<
"Error writing uncompressed data "
104 <<
"to dest file " << target <<
": "
105 <<
"wrote " << bytes_written <<
" "
106 <<
"instead of " << bytes_read ;
109 remove( target.c_str() ) ;