Code:
# include & lt; Zlib. H>
# include & lt; Iostream>
# include & lt; String>
using namespace std;
Int main ()
{
Char * filename="TS21z_X_R2_000100. Gz";
GzFile GZFP=gzopen (filename, "rb");
If (GZFP==NULL)
{
Printf (" error "\ n");
return false;
}
//distribution of 4 bytes (float)
Char data [4].
Memset (data, 0, sizeof (data));
//read 4 bytes
Gzread (GZFP, data, 4);
//gzgets (GZFP, data, 4);
Printf (" \ n % f ", * (float *) data);
Gzclose (GZFP);
Printf (" successfully read earthquake data \ n ");
return 0;
}
CodePudding user response:
If it is a binary is not the same, you need to specify the parameters such as the "rb" if there are other parameters, the building Lord your checkCodePudding user response:
Zlib uncompress gziphttps://www.cnblogs.com/guoxiaoqian/p/4315195.html