ZIP / UnZIP

New to FreeBASIC? Post your questions here.
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

ZIP / UnZIP

Post by Makoto WATANABE »

I'd like to ZIP compression / decompression.
I think "ExtLibZip" is valid, but the example program becomes the error below.
http://www.freebasic.net/wiki/wikka.php?wakka=ExtLibZip

Please teach me how to fix it.

libzip.bas(27) error 58: Illegal specification, at parameter 1 (zip) of unpack_zip_file() in 'Private Sub unpack_zip_file(ByVal zip As zip Ptr, ByVal i As Integer)'
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: ZIP / UnZIP

Post by fxm »

In the example, try to replace:

ByVal zip As zip Ptr
by:
ByVal zip As Any Ptr

Dim As zip_file Ptr fi
by:
Dim As Any Ptr fi

Dim As zip Ptr zip
by:
Dim As Any Ptr zip
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: ZIP / UnZIP

Post by dodicat »

A while ago I used zlib for this.
(I have not tried zip)
This will compress and decompress single files.
Drag and drop.
32 bits.
http://www.mediafire.com/file/2rhd5hyf6246ly5/zlib.zip
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: ZIP / UnZIP

Post by MrSwiss »

@dodicat,

libzip is also making use of zlib (under the hood).
However, it is extending the use to, e.g. managing existing archives ...
libzip/readme at NiH.at.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: ZIP / UnZIP

Post by fxm »

ExtLibZip → fxm [Update the example for compiling OK]

For the example, libzip.a for Win32 can be found here:
FB-win32-libzip-0.11.zip
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: ZIP / UnZIP

Post by Makoto WATANABE »

Dear fxm

Thank you for updating the example.
I could compile the example program and unpack .zip.

P.S.
This example is .zip unpacking using libzip.
If someone adds examples of .zip compression using libzip to the document, beginners will become happier.
Roland Chastain
Posts: 1002
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: ZIP / UnZIP

Post by Roland Chastain »

Hello ! When I try to compile the example, I get this error:
c:\fbc\1.05.0\bin\win32\ld.exe: cannot find -lz
I get also the same error when I try to compile the example provided by dodicat.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: ZIP / UnZIP

Post by fxm »

Makoto WATANABE wrote:If someone adds examples of .zip compression using libzip to the document, beginners will become happier.
ExtLibZip → fxm [Add example of packing using libzip]
Last edited by fxm on May 27, 2017 6:24, edited 1 time in total.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: ZIP / UnZIP

Post by fxm »

Roland Chastain wrote:Hello ! When I try to compile the example, I get this error:
c:\fbc\1.05.0\bin\win32\ld.exe: cannot find -lz
I get also the same error when I try to compile the example provided by dodicat.
Have you the library file 'libz.a' (in ...\lib\win32\) ?
Roland Chastain
Posts: 1002
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: ZIP / UnZIP

Post by Roland Chastain »

fxm wrote:Have you the library file 'libz.a' (in ...\lib\win32\) ?
Thanks for your answer. No, I don't have that library.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: ZIP / UnZIP

Post by fxm »

You can get 'libz.a' at:
http://users.freebasic-portal.de/stw/builds/
in file:
win32_mingw_additional_libs.zip
Roland Chastain
Posts: 1002
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: ZIP / UnZIP

Post by Roland Chastain »

Thank you fxm. ;)
Roland Chastain
Posts: 1002
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: ZIP / UnZIP

Post by Roland Chastain »

fxm wrote:
Makoto WATANABE wrote:If someone adds examples of .zip compression using libzip to the document, beginners will become happier.
ExtLibZip → fxm [Add example of packing using libzip]
Thank you for the new example.
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: ZIP / UnZIP

Post by Makoto WATANABE »

Dear fxm
Thanks for your quick response.
I am very happy.

By the way, I found another associated topic.
http://www.freebasic.net/forum/viewtopic.php?t=18627
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: ZIP / UnZIP

Post by fxm »

The example I added to the documentation is taken from the last post of this topic !
Post Reply