Re: /IUP/ Help needed with examples
- Posted by ghaberek (admin) Jan 05, 2016
- 2195 views
jmduro said...
_tom said...
- ( ? what is arq ) IupGetFile
I don't know why it is called arq: it should be filename. Here is what IUP documentation writes:
filename: This parameter is used as an input value to define the default filter and directory. Example: "../docs/*.txt". As an output value, it is used to contain the filename entered by the user.
It's called arq in iup.h so that's what comes through via the wrapper. I have to work on a better method of automatically correcting these one-off problems.
Until I get this wrapped correctly, here's how you'd call IupGetFile().
include std/machine.e include iup/iup.e function myIupGetFile( sequence filename = "" ) -- IUP documentation for IupGetFile states: -- "The string is limited to 4096 characters." atom arq = allocate_data( 4096 ) mem_set( arq, 0, 4096 ) poke( arq, filename ) integer result = c_func( xIupGetFile, {arq} ) if result != -1 then filename = peek_string( arq ) else -- user cancelled filename = "" end if free( arq ) return filename end function
Edit: I added an issue to work on this: IupGetFile should accept and return a sequence.
-Greg