FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Tue Feb 24, 2009 04:11 AM

Dear All,

I've searched in the forum about this topic and it has many options and many solutions. I would like to know what exactly need for ZIP/UNZIP for Harbour/xHarbour (FTDN). Because I think many people ask this question many time.

  • Which does library need for Harbour and xHarbour (FTDN)?
  • Which DLL need for each?
  • Samples?

Any help are appreciated.

Thanks in advance for kindly help,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Tue Feb 24, 2009 08:41 AM
Dutch,

you must link hbzip.lib.

You can use hb_ZipFile() and hb_UnzipFile ().
lOk := hb_ZipFile( ::cTarget  , ;
                           aFiles , ;
                           ::nCompress , ;
                           bZip  , ;
                           ::lOverwrite , ;           // overwrite
                           ::cPassword  , ;
                           ::lWithPath,;               // with path
                           ::lWithDrive  )

lOk := hb_UnZipFile( ::cZip        , ;
                            bOnUnZipFile  , ;
                            ::lWithSubDir   , ;
                            ::cPassword     , ;
                            ::cZipDir + "\" ,;
                            ::aFiles        ,;
                            ::bProgress)
kind regards

Stefan
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Tue Feb 24, 2009 09:08 AM
Dear Stefan,

I've in xHarbour\Lib but it is not compatible with Harbour. It has no in Harbour\Lib.
Where can I get it?
Have I need to link HBZLIB.LIB too?

StefanHaupt wrote:Dutch,

you must link hbzip.lib.

You can use hb_ZipFile() and hb_UnzipFile ().



Regards,
Dutch
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Tue Feb 24, 2009 09:51 AM

Dutch,

Maybe you should consider to migrate to xharbour, as it may be easier for you.

In Harbour there are less users and the programmers needs to be more experienced with Harbour itself.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Tue Feb 24, 2009 09:54 AM

Dutch,

Here you have hbzlib.lib for Harbour:

http://www.mediafire.com/?sharekey=414c ... 0a1ae8665a

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Tue Feb 24, 2009 10:05 AM
Dear Antonio,

I think so, because I've found almost use xHarbour and it has more features than Harbour.
I try ZIPFILE with xHarbour, it's ok.

Antonio Linares wrote:Dutch,

Maybe you should consider to migrate to xharbour, as it may be easier for you.

In Harbour there are less users and the programmers needs to be more experienced with Harbour itself.


Regards,
Dutch
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Sat Nov 28, 2009 06:58 AM
I am using xHarbour. I modified the Buildx.Bat and added the lib hbzip.lib unfortunately I get so many errors
Code (fw): Select all Collapse
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_inflateEnd' referenced from D:\XHARBOUR\LIB\HBZIP.LIB|ziparchive
Error: Unresolved external '_deflate' referenced from D:\XHARBOUR\LIB\HBZIP.LIB|ziparchive
Error: Unresolved external '_get_crc_table' referenced from D:\XHARBOUR\LIB\HBZIP.LIB|ziparchive
Error: Unresolved external '_deflateEnd' referenced from D:\XHARBOUR\LIB\HBZIP.LIB|ziparchive
Error: Unresolved external '_deflateInit2_' referenced from D:\XHARBOUR\LIB\HBZIP.LIB|ziparchive
Error: Unresolved external '_crc32' referenced from D:\XHARBOUR\LIB\HBZIP.LIB|ziparchive
Error: Unresolved external '_inflateInit2_' referenced from D:\XHARBOUR\LIB\HBZIP.LIB|ziparchive
Error: Unresolved external '_inflate' referenced from D:\XHARBOUR\LIB\HBZIP.LIB|ziparchive
* Linking errors *
Is there any linking order of hbzip lib. In the buildx.bat, I have linked the lib hbzip lib as the last xHarbour lib (just before the commands to link Borland libs)

echo %hdirl%\pcrepos.lib + >> b32.bc
echo %hdirl%\hbzip.lib + >> b32.bc

rem Uncomment these two lines to use Advantage RDD
rem echo %hdir%\lib\rddads.lib + >> b32.bc
rem echo %hdir%\lib\Ace32.lib + >> b32.bc

echo %bcdir%\lib\cw32.lib + >> b32.bc
echo %bcdir%\lib\import32.lib + >> b32.bc
Code (fw): Select all Collapse
*------------------------------------*
Function ExtractZip(cDriveLetter)
*------------------------------------*
Local aFiles,lOk
// Zip and Unzip functions, should include the lib named zlib available in \xHarbour\lib
aFiles := hb_GetFilesInZip("Test.Zip") 
lOk := hb_unzipfile(cFile,,,,cDriveLetter,aFiles,NIL)
Return
Regards
Anser
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Sat Nov 28, 2009 09:46 AM

Anser,

You have to link zlib.lib also

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Sat Nov 28, 2009 09:52 AM
Solved the Linking error.

You need to add xHarbour libs ZLib.lib and HbZip.Lib.

There are no runtime errors, but I am unable to extract the Zip file contents.
*------------------------------------*
Function ExtractZip()
*------------------------------------*
Local aFiles,lOk
// Zip and Unzip functions, should include the lib named zlib and HbZip libs available in \xHarbour\lib
aFiles := hb_GetFilesInZip("Test.Zip")  // ValType of aFiles is NIL
lOk := hb_unzipfile("Test.Zip,,,,"F:\",aFiles,NIL)  // No Errors but not functioning
Return
The "Test.Zip" is created using WinZip and is zip of of a directory containing multiple ( 4 to 5) directories
Any hints ?

Regards
Anser
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Sat Nov 28, 2009 10:02 AM

Sorry it was my mistake. I had problem with the Zip files Path.

If you need to extract zip file with the Path details then the 3rd Parameter should be .T.
lOk := hb_unzipfile("E:\Test.Zip",,.T.,,"F:\",aFiles,NIL)

It is working fine

Regards
Anser

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Sat Nov 28, 2009 10:05 AM

Anser,

very good :-)

many thanks for your feedback

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Sat Jun 19, 2010 06:34 AM
anserkk wrote: ...
If you need to extract zip file with the Path details then the 3rd Parameter should be .T.
lOk := hb_unzipfile("E:\Test.Zip",,.T.,,"F:\",aFiles,NIL)

It is working fine
...
Dear Mr. Anser,

I successfully zipped a file using:
...
HB_ZipFile('file.zip',{'filetozip.txt'}, {|cFile, nPos| oSay1:SetText( cFile ) },.T.,,,{|nBytes, nSize| oSay2:SetText(cValToChar(nBytes)+'/'+cValToChar(nsize)) })    //return .T. and zip file created.
...
aFiles := HB_GetFilesInZip( 'file.zip' )
...
HB_UnZipFile( 'file.zip' ,,.T.,,".\",aFiles, Nil )  //return .F. and file not unzipped., even if I used absolute paths 'd:\file.zip'... 'd:\'...
Still cannot unzip with HB_UnzipFile()...

Im using FWH10.5, BCC582 and XHB 1.21.5714... added library hbzip.lib and zlib.lib


Regards,
Frances
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Sat Jun 19, 2010 08:11 AM
Dear All,

Using HB_UnZipFile( 'File.Zip', , , , , "*.*") successfully extracted the content of 'file.zip', HOWEVER, the return value is always .F... but successfully done the decompression..

BUG?


Regards,
Frances
Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 811
Joined: Tue May 06, 2008 04:28 AM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Wed Jun 30, 2010 04:32 AM

Dear All,

nobody experienced this on BCC582 and FWH 10.6?

Regards,
Frances

Kind Regards,

Frances



Fivewin for xHarbour v18.07

xHarbour v1.2.3.x

BCC 7.3 + PellesC8 ( Resource Compiler only)

ADS 10.1 / MariaDB

Crystal Reports 8.5/9.23 DE

xMate v1.15
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?
Posted: Wed Jun 30, 2010 06:11 AM
Dear Mr.Frances,

The below given code is working fine for me.

hb_unzipfile("Apps.Zip",,.T.,,cExtractToPath,aFiles,NIL) returned .T. for me

I have used FWH 10.6 Buildx.bat to compile and run the test.
#include "Fivewin.ch"
//----------------------------//
Function Main()
    Local oDlg,oBtn
    
    DEFINE DIALOG oDlg TITLE "Test UnZip"
    
    @1,5 BUTTON oBtn PROMPT "Unzip" ;
         ACTION MsgInfo( If(ExtractZip("D:\MyTest\"),"OK","Not OK") ) // Returned .T.

    ACTIVATE DIALOG oDlg

Return NIL

*------------------------------------*
Function ExtractZip(cExtractToPath)
*------------------------------------*
Local aFiles,lOk
// Zip and Unzip functions, should include the libs named HbZip & zlib available in \xHarbour\lib

// Array containing the list of files in the Zip with Path
aFiles := hb_GetFilesInZip("Apps") 

// The 3rd Parameter should be .T. if you need to extract contents of zip file as per Path
lOk := hb_unzipfile("Apps",,.T.,,cExtractToPath,aFiles,NIL)
Return lOk
The contents of the zip file (Apps.zip) was properly extracted inside the folder D:\MyTest
I suggest you to check the path

Regards

Anser