Trouble with std.zlib

Andrew Wiley wiley.andrew.j at gmail.com
Tue Jul 19 01:05:07 PDT 2011


I'm using std.zlib in an application, and I'm having trouble decompressing a
file. The file is gzipped, and I can easily see the contents with `cat file
| gzip -d` but this code doesn't work:
auto arr = read("file.gz");
ubyte[] realarr = cast(ubyte[])uncompress(arr);

output:
std.zlib.ZlibException at std/zlib.d(59): data error

>From the header file, it seems like zlib should be detecting a gzip header
and *just working*, but, well, it isn't. I have to store data in a
compressed format, and eventually the code I'm writing will be used
in-memory instead of on files, so I'm going to have to uncompress it
somehow.
Has anyone encountered this before?

Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110719/fa96fab6/attachment.html>


More information about the Digitalmars-d mailing list