小编Tal*_*lei的帖子

Qt quncompress gzip数据

我偶然发现了一个问题,无法找到解决方案.

所以我想做的是使用qUncompress(QByteArray)在qt中解压缩数据,从gzip格式的www发送.我使用wireshark确定这是有效的gzip流,也用zip/rar测试,两者都可以解压缩它.

代码到目前为止,是这样的:

    static const char dat[40] = {
         0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xaa, 0x2e, 0x2e, 0x49, 0x2c, 0x29,
         0x2d, 0xb6, 0x4a, 0x4b, 0xcc, 0x29, 0x4e, 0xad, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x00,
         0x2a, 0x63, 0x18, 0xc5, 0x0e, 0x00, 0x00, 0x00
    };
//this data contains string: {status:false}, in gzip format
QByteArray data;
           data.append( dat, sizeof(dat) );

unsigned int size = 14; //expected uncompresed size, reconstruct it BigEndianes

//prepand expected uncompressed size, last …
Run Code Online (Sandbox Code Playgroud)

c++ qt zlib

11
推荐指数
3
解决办法
2万
查看次数

标签 统计

c++ ×1

qt ×1

zlib ×1