Re: newbie questions
>From: praufast at free.fr
>Subject: newbie questions
>
>
> Hello,
>
>I'm new to Euphoria and my last programming was some Basic, 15 years ago at
>school !
>I try to access a dll ( BigSpeedZip.dll, fast zipping/unzipping) but i'm
>stupidly stuck there.
>The VB declare for the function i want to use :
>'.....This function opens zip file and creates a list of items,
>corresponding to
>' contents of zip file. Must be called before any other function to get
>access
>' to zip file. ZipName is the path and full name of zip file,
>' for example: 'C:\TEST.ZIP'. Returns zero on success.
>Declare Function zOpenZipFile Lib "bszip.dll" (ByVal zipname As String) As
>Long
>
>And here is a part of my EU 2.3code, win32 :
>--
>atom bszip
>sequence ZipFile
>bszip = open_dll("bszip.dll")
>ZipFile="c:\\indisp.zip"
>OpenZipFile = link_c_func(bszip, "zOpenZipFile",{C_CHAR}, C_INT)
> ok = c_func (OpenZipFile, ZipFile) -- error message here "C routine
>zOpenZipFile() needs 1 argument, not 13"
>-- if i put 13 C_CHAR between the braces, it hangs
>-- if instead of ZipFile="c:\\indisp.zip" i write ZipFile
>=open("c:\\indisp.zip", "ub") the error is "c_proc/c_func: argument list
>must be a sequence ", so what to do ?
>puts(1,ok) --end code
Since ZipFile is a string, it must be passed via a pointer. The function
should read:
--
include dll.e
include machine.e
atom bszip, lpZipFile
integer OpenZipFile, ok
sequence ZipFile
bszip = open_dll("bszip.dll")
ZipFile = "c:\\indisp.zip"
OpenZipFile = define_c_func(bszip, "zOpenZipFile", {C_POINTER}, C_INT)
-- Allocate pointer for string
lpZipFile = allocate_string(ZipFile)
ok = c_func(OpenZipFile, {lpZipFile})
-- Make sure to free allocated space
free(lpZipFile)
puts(1,ok) --end code
>Another question : how to get the actual filename from a file number ( eg
> c:\indisp.zip vs 1342177280 ) ?
>
I don't know how to do that. Try looking at the docs for the DLL.
|
Not Categorized, Please Help
|
|