|
|
Zlib and VB6...
Good morning...
I try to uncompress .gz files created by GnuZip, with the Zlib.dll in
VB6, but I get a -3 error (file corrupted).
What's wrong with my prog ?
Thanks...
Ben.
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"
(hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Private Declare Function ZUncompress Lib "zlib.dll" Alias "uncompress"
(dest As Any, destLen As Any, src As Any, ByVal srcLen As Long) As Long
Public Sub UncompressFile(pSrc As String, pTgt As String)
Dim lOrigSize As Long 'original size
Dim bOrigData() As Byte 'output buffer
Dim lCompSize As Long 'compressed size
Dim bCompData() As Byte 'data buffer
Dim lPosSize As Long
Dim fnum As Integer
Dim zRet As Long
' Load the source file into a byte array.
lCompSize = FileLen(pSrc)
ReDim bCompData(0 To lCompSize - 1)
fnum = FreeFile
Open pSrc For Binary Access Read As #fnum
Get #fnum, , bCompData()
Close #fnum
' get the original size
lPosSize = lCompSize - 4
CopyMemory lOrigSize, bCompData(lPosSize), 4
ReDim bOrigData(0 To lOrigSize - 1)
zRet = ZUncompress(bOrigData(0), lOrigSize - 1, bCompData(0),
lCompSize)
MsgBox Str(zRet) 'retourne erreur -3 **********************
Erase bCompData 'deallocate data buffer
' Remove the existing file, then write buffer in it.
On Error Resume Next
Kill pTgt
On Error GoTo 0
Open pTgt For Binary Access Write As #fnum
Put #fnum, , bOrigData()
Close #fnum
Erase bOrigData 'deallocate return buffer
End Sub
|
|
0
|
|
|
|
Reply
|
benfbox-google (2)
|
10/7/2005 8:05:47 AM |
|
|
0 Replies
452 Views
(page loaded in 0.28 seconds)
Similiar Articles: Need Code to Uncompress/Decompress PNG Data - comp.compression ...There are compiler switches that turn that stuff off IIRC in the ZLib source. Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: EDais@mvps.org WWW ... Stumped on FlateDecode - comp.text.pdfI know from the docs that FlateDecode works with the "zlib/deflate compression method ... Stumped on FlateDecode - comp.text.pdf Base64 encode in VB6, decode in Java PROBLEM ... GIF decoder - comp.compressionBase64 encode in VB6, decode in Java PROBLEM!!! - comp.lang.java ... GIF decoder ... GIF decoder - comp.compression GIF decoder - comp.compression | Computer Group Zlib ... libmysql.lib link problem in Visaual C++ - comp.databases.mysql ...... static link -- visual c libraries I'm trying to static link a .LIB file (the ZLib ... C++, Visual Basic, Java, TCL, Perl, Python, etc (DLL and SWIG capable). INI ... zlib Home Sitezlib 32-bit OCX (C++ source and binaries for use with Visual Basic 4.x or Delphi 2.0) (unsupported VB5 binary also available) zlib Pascal port ... vbAccelerator - Compressing and Expanding with the Freeware zLib.DLLYou can compress data in memory, or using file IO in Visual Basic you can also compress files. About zLib. ZLib is an excellent compression technique and has been re-used ... 7/17/2012 7:53:49 PM
|
|
|
|
|
|
|
|
|