zip unzip problem

zip unzip problem

Postby ztibor » Wed Jun 18, 2008 1:14 pm

what do I have to do to manage compeling testzip.prg ?

We got this errors.

hbzip.lib is not included in harbour package.

Where can we get the tools which solve the our Problem ?

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄż
ł FiveWin for Harbour 8.01 - Jan. 2008 Harbour development power łÜ
ł (c) FiveTech, 1993-2008 for Microsoft Windows 95/98/NT/2000/ME/XP/Vista łŰ
ŔÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄŮŰ
˙ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
Harbour Beta build 0.99-3 Intl.
Copyright 1999-2007, http://www.harbour-project.org/
Compiling 'testzip.prg'...

Lines 3690, Functions/Procedures 4
Generating C source output to 'testzip.c'... Done.
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
testzip.c:
Borland Resource Compiler Version 5.40
Copyright (c) 1990, 1999 Inprise Corporation. All rights reserved.
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external '_HB_FUN_ZIPFILE' referenced from V:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPTYPE' referenced from V:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPBLOCK' referenced from V:\FWH\SAMPLES\TESTZIP.OBJ
Error: Unresolved external '_HB_FUN_ZIPMSG' referenced from V:\FWH\SAMPLES\TESTZIP.OBJ
* There are errors
ztibor
 
Posts: 1
Joined: Tue Jun 17, 2008 8:56 am

Postby Antonio Linares » Wed Jun 18, 2008 1:49 pm

ztibor,

samples\TestZip.prg is for 16 bits only.

You have to use xHarbour/Harbour provided HBZIP.lib library

Here you have a working sample:
Code: Select all  Expand view
//
// $Id: testzip.prg,v 1.6 2003/09/15 02:57:10 paultucker Exp $
//

// Requires samples.lib for gauge support
//

#include "common.ch"
#include "setcurs.ch"

proc Main()
Local aFiles, aGauge, nLen, aDir
Local aSaveFiles
Local aGaugeFile

   // This is the 'safe' thing to do until Alert() is given focus.
   SetMode( 50,80 )

   ZipCreate( "TEST.ZIP", "testzip.prg" )

   aFiles := {"testzip.prg",GetEnv("windir")+ "\win.ini"}
   nLen   := Len(afiles)

   ZipCreate( "TEST1.ZIP", aFiles[2] )
   ZipCreate( "TEST2.ZIP", aFiles, 8, {|cFile,nPos| qout("Added " + cFile)})

   // something here is not clipper compatible
   // (These can be removed after the box drawing is corrected)
   ?;?;?
   ?
   ?;?;?

   aGauge := GaugeNew( row()-6, 5, row()-4,74 , "W/B", "W+/B" ,'²')
   GaugeDisplay( aGauge )

   aGaugeFile := GaugeNew( row()+2, 5, row()+4,74 , "W/B", "W+/B" ,'²')
   GaugeDisplay( aGaugeFile )

   aFiles := {}

   aDir   := Directory( "*.prg" )
   Aeval( aDir, {|a| aadd( aFiles, a[1]) })

   /* lets add an new bigger files on this example*/
   aDir   := Directory( "*.map" )
   Aeval( aDir, {|a| aadd( aFiles, a[1]) })

   aDir   := Directory( "*.c" )
   Aeval( aDir, {|a| aadd( aFiles, a[1]) })
   nLen   := Len(afiles)

   // Lets save aFile  Array for later usage
   aSaveFiles := aFiles

   set cursor off

   ZipCreate("test3.zip", aFiles, 8, ;
              {|cFile,nPos| GaugeUpdate(aGauge,nPos/nLen) },,'hello',,,;
              {|nPos,nCur| GaugeUpdate(aGaugeFile,nPos/nCur)})

   set cursor on

   ? str( nlen ) +" files were added to the zip"

   // method 1
   aFiles :=  hb_GetFilesInZip( "test3.zip" )
   if aFiles != NIL
      ? str( Len( aFiles ) ) + " files are in the zip"
   endif
   // or simpler, method 2
   ? str( hb_GetFileCount("test3.zip" ) ) + " files using alternate method"

   ZipHasPassword( "TEST1.ZIP" )
   ZipHasPassword( "test3.zip" )

   //ok, now we create an file on an floppy
   ? "Put a formatted Floppy/Zip disk in drive A: and press any key - (ESC) to skip"
   ? "Existing files will not be deleted!"
   Inkey( 0 )
   if lastkey() != 27

      Cls
      // no need for all the qout's after a cls.

      aGauge := GaugeNew( row(), 5, row()+2,74 , "W/B", "W+/B" ,'²')
      GaugeDisplay( aGauge )
      ?;?
      aGaugeFile := GaugeNew( row(), 5, row()+2,74 , "W/B", "W+/B" ,'²')
      GaugeDisplay( aGaugeFile )

      HB_SETDISKZIP( { | x |  Alert( "Please insert disk no " + Str( x , 3 ) ) } )

      set cursor off

      ZipCreateToFloppy("test4.zip", aSaveFiles, 9, ;
                 {|cFile,nPos| GaugeUpdate(aGauge,nPos/nLen) },,'hello',,,;
                 {|nPos,nCur| GaugeUpdate(aGaugeFile,nPos/nCur)})

      set cursor on

   endif

function ZipCreate(cFile, uContents, nLevel, bUpdate, lOverwrite, password,;
                   lPath, lDrive, bFileUpdate)
   Local lRet

   Default lOverwrite to .t.
   Default lPath to .t.

   IF ( lRet := HB_ZIPFILE( cFile, uContents, nLevel, bUpdate, lOverwrite,;
                            password, lPath, lDrive, bFileUpdate) )
      ? cFile + " was successfully created"
   ENDIF

Return lRet

function ZipCreateToFloppy(cFile, uContents, nLevel, bUpdate, lOverwrite, password,;
                   lPath, lDrive, bFileUpdate)
   Local lRet

   Default lOverwrite to .t.
   Default lPath to .t.

   IF ( lRet :=  HB_ZIPFILEBYPKSPAN ( "a:\" + cFile, uContents, nLevel, bUpdate, lOverwrite,;
                            password, lPath, lDrive, bFileUpdate) )
      ? cFile + " was successfully created"
   ENDIF

Return lRet


Function ZipHasPassword( cFile )
   Local lRet

   ? cFile + " has " + iif(lRet := hb_ZipWithPassword(cFile),"a","no" )+ " password"

Return lRet
regards, saludos

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

Postby Otto » Sun Jul 20, 2008 11:04 pm

Antonio,
would you be so kind to post the necessary changes in buildh.bat/buildx,bat to compile this sample.
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 59 guests