Answer the question
In order to leave comments, you need to log in
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
1. ShellExecute
(For example, 7-zip)
2.Lines.LoadFromFile
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.
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 questionAsk a Question
731 491 924 answers to any question