D
D
Doniyor Mamatkulov2019-01-18 19:08:00
Delphi
Doniyor Mamatkulov, 2019-01-18 19:08:00

How to unzip a gz file in Delphi?

You need to write a program to extract files from a gz archive.
What is available: gz file about 150 MB in size. Inside it has one file with the .log extension (logs from the router).
What you need to do:
1. Take the gz archive and extract its contents to a temporary folder.
2. Get the lines from the .log file and add them to TMemo.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Tsvetkov, 2019-01-18
@doniyorbekm

1. ShellExecute(For example, 7-zip)
2.Lines.LoadFromFile

P
pfemidi, 2019-01-18
@pfemidi

Why in a temporary folder? You just need to use the TZDecompressionStream from the ZLib unit (System.ZLib in new versions of Delphi, just ZLib in older ones). Here everything is explained in detail by Embarcadero himself.

R
Roman Mirilaczvili, 2019-01-18
@2ord

Inventing zcat and grep in Delphi?
I do not recommend unpacking the 150 MB log directly in TMemo: it will fill up all available RAM and everything will hang for nothing.
It's better like this: it 's better to
"view" the result page by page, using pipe.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question