HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby dutch » Tue Feb 24, 2009 4: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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby StefanHaupt » Tue Feb 24, 2009 8:41 am

Dutch,

you must link hbzip.lib.

You can use hb_ZipFile() and hb_UnzipFile ().

Code: Select all  Expand view
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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby dutch » Tue Feb 24, 2009 9: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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby Antonio Linares » Tue Feb 24, 2009 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41476
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby Antonio Linares » Tue Feb 24, 2009 9:54 am

Dutch,

Here you have hbzlib.lib for Harbour:
http://www.mediafire.com/?sharekey=414c ... 0a1ae8665a
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41476
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby dutch » 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 19.01 / 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)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby anserkk » Sat Nov 28, 2009 6:58 am

I am using xHarbour. I modified the Buildx.Bat and added the lib hbzip.lib unfortunately I get so many errors

Code: Select all  Expand view
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)


Code: Select all  Expand view
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: Select all  Expand view
*------------------------------------*
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
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby Antonio Linares » Sat Nov 28, 2009 9:46 am

Anser,

You have to link zlib.lib also
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41476
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby anserkk » Sat Nov 28, 2009 9: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.

Code: Select all  Expand view
*------------------------------------*
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
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby anserkk » 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
Last edited by anserkk on Sat Nov 28, 2009 10:06 am, edited 1 time in total.
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby Antonio Linares » Sat Nov 28, 2009 10:05 am

Anser,

very good :-)

many thanks for your feedback
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41476
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby fraxzi » Sat Jun 19, 2010 6: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:
Code: Select all  Expand view

...
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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby fraxzi » Sat Jun 19, 2010 8: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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby fraxzi » Wed Jun 30, 2010 4: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
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: HB_ZIPFILE() & HB_UNZIPFILE() for Harbour/xHarbour (FTDN)?

Postby anserkk » Wed Jun 30, 2010 6: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.

Code: Select all  Expand view
#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
User avatar
anserkk
 
Posts: 1331
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 22 guests