Extracting gz compressed file.

Windows specific forum
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Extracting gz compressed file.

Post by jassing »

Couldn't search the forum -- 'gz' is too small.
Using google, I either ended up on either a unix, PureZIP, or ZLib/purebasic page(zlib's example didn't work.)

I have to download a file on a regular basis and then extract/process the file but it is a .gz compressed file.

Other than shelling out to a gunzip util/port -- any ideas?

Thanks
-josh
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Extracting gz compressed file.

Post by IdeasVacuum »

If it is always the same file, you can just hard-code the gzip command. Otherwise, since the gzip file name is the same as the original file, your app can extract the file name from the .gz file and then concat the command.

Code: Select all

RunProgram("C:\Program Files\GnuWin32\bin\gzip","-d C:\MyGzipFiles\SampleFile.txt.gz","",#PB_Program_Wait)

MessageRequester("Done", "Done")

End
Tested on WinXP 32bit. You can of course use other decompression apps such as WinRar in the same way.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: Extracting gz compressed file.

Post by gnozal »

Hi,

you may try the following include + static ZLIB : http://gnozal.ucoz.com/PBLIB_ZLIB_Stati ... c_GZip.zip
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: Extracting gz compressed file.

Post by jassing »

Thanks! I'll check the dll.

-j
Post Reply