<p>I am trying to uncompress some data created in VB6 using the zlib API.</p>

<p>I have read this is possible with the qUncompress function:
<a href="http://doc.trolltech.com/4.4/qbytearray.html#qUncompress" rel="nofollow noreferrer">http://doc.trolltech.com/4.4/qbytearray.html#qUncompress</a></p>

<p>I have read the data in from QDataStream via readRawBytes into a char
array, which I then converted to a QByteArray for decompression. I
have the compressed length and the expected decompressed length but am not getting
anything back from qUncompress.</p>

<p>However I need to prepend the expected decompressed length in big endian format. Has anybody done this and have an example?</p>

I haven't used VB6 in
ages
, so I hope this is approximately correct.  I
think
that vb6 used () for array indexing.  If I got anything wrong, please let me know.
Looking at the qUncompress docs, you should have put your data in your QByteArray starting at byte 5 (I'm going to assume that you left the array index base set to 1 for this example).
Let's say the array is named qArr, and the expected uncompressed size is Size.
In a "big-endian" representation, the first byte is at the first address.
```
```
qArr(1) = int(Size/(256*256*256))
qArr(2) = 255 And int(Size/256*256)
qArr(3) = 255 And int(Size/256)
qArr(4) = 255 And int(Size)
```
```
Does that make sense?
If you needed little endian, you could just reverse the order of the indexes (qArr(4) - qArr(1)) and leave the calculations the same.