use qUncompress to uncompress data compressed by zlib with another application
Unsolved
General and Desktop
-
Hi,
I have two applications. One is written in delphi, which is compressing data with zlib.
The other one is written in c++ which should uncompress this data.In detail:
In delphi I create a file compress it and add a 4 byte header to the compressed data:destStream := TFileStream.Create(SaveDialog1.FileName, fmCreate); destStream.WriteData(sourceStream.Size, 4); // here I add the header for qUncompress sourceStream.Seek(0, soFromBeginning); LZip := TZCompressionStream.Create(clMax, destStream); LZip.CopyFrom(sourceStream, sourceStream.Size);
In QT i try to uncompress this data like this:
QFile file("E:\\Temp\\wheels\\test.adb"); if (!file.open(QIODevice::ReadOnly)) return; QByteArray compressed = file.readAll(); qDebug() << "Compresed=" << compressed.size(); QByteArray uncompressed = qUncompress(compressed); // HERE I GET: qUncompress: Input data is corrupted qDebug() << "UnCompresed=" << uncompressed.size();
Any idea what I'm doing wrong?
Unfortunately I haven't seen the source of qUncompress yet. So don't know what it is expecting.THX
mts -