Re: /IUP/ Help needed with examples

new topic     » goto parent     » topic index » view thread      » older message » newer message
jmduro said...
_tom said...
  1. ( ? 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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu