Question about zip.h/zip.c used in zlib using VB...

Question about zip.h/zip.c used in zlib using VB...

Post by leewal.. » Sat, 06 May 2000 04:00:00



I've been trying to use the functions exported by zlib.dll that are in
zip.h.  What I want to do is open an existing zip file and append a new
file.

If the source zip file (source.zip) already contains a file
(test1.txt), and I want to add another file (test2.txt), then how would
I accomplish this?

My source looks like this:

    Dim lRC As Long
    Dim lAppend As Long
    Dim zi As zip_fileinfo
    Dim hZFile As Long
    Dim bytData() As Byte

    lAppend = 1

    hZFile = zipOpen("source.zip", lAppend )
    lRC = zipOpenNewFileInZip(hZFile, "test2.txt", zi, Null, 0, Null,
0, vbNullString, m_zcmCompressionMethod, m_zclCompressionLevel)
    If GetData(m_sSourcePath, bytData()) Then
        lRC = zipWriteInFileInZip(hZFile, bytData(0), UBound(bytData))
    End If
    lRC = zipCloseFileInZip(hZFile)
    lRC = zipClose(hZFile, vbNullString)

What happens is that test1.txt no longer exists in the zip file.  The
only file in the zip file is test2.txt.

Thank you,
Lee Wallen

Sent via Deja.com http://www.deja.com/
Before you buy.