[bds 2006] Decompress .gz files with zlib unit?
- From: "Richard A. DeVenezia" <rdevenezia@xxxxxxxxxxxx>
- Date: Tue, 24 Jan 2006 11:33:09 -0500
Haven't used Delphi in ages, starting back up with bds 2006.
I have a bunch of .gz files that need to be decompressed (on the fly) before
I can use the data inside them.
The files are not corrupt -- WinZip was unable decompress them.
The simple console program below raises an Application Error dialog
"The exception unknown software exception (0x0eedfade) occurred in the
application at location 0x7c59bc3f"
and writes out
Exception ECompressionError in module Project2.exe at 00010AA7.
Error.
Have I missed something?
Do I need a different decompression library ?
----------------
program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils, Classes, ZLib;
type
PHugeCharArray = ^THugeCharArray;
THugeCharArray = array[0..0] of Char;
var
z: TDecompressionStream;
bufferSize: Integer;
pBuffer: PHugeCharArray;
bytesRead: Integer;
begin
bufferSize := 1000;
GetMem (pBuffer, bufferSize);
z := TDecompressionStream.Create(TFileStream.Create('c:\temp\xyz.txt.gz',
fmOpenRead));
bytesRead := z.Read(pBuffer^, bufferSize);
z.Free();
WriteLn (bytesRead, ' bytes read.');
WriteLn (String(pBuffer^));
FreeMem(pBuffer, bufferSize);
WriteLn('Done.');
ReadLn;
end.
----------------
The first ten bytes of the .gz are this:
1F 8B 08 08 3A E5 D4 3A 00 03
Richard
.
- Follow-Ups:
- Re: [bds 2006] Decompress .gz files with zlib unit?
- From: Uffe Kousgaard
- Re: [bds 2006] Decompress .gz files with zlib unit?
- From: Wolfgang Ehrhardt
- Re: [bds 2006] Decompress .gz files with zlib unit?
- From: Andreas Koch
- Re: [bds 2006] Decompress .gz files with zlib unit?
- Prev by Date: TColumn.Showing
- Next by Date: Re: [bds 2006] Decompress .gz files with zlib unit?
- Previous by thread: TColumn.Showing
- Next by thread: Re: [bds 2006] Decompress .gz files with zlib unit?
- Index(es):
Relevant Pages
|
Loading