[futurebasic] Re: [FB] Function functionality

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2011 : Group Archive : Group : All Groups

From: Dan Baeckström <dan.baeckstrom@...>
Date: Tue, 24 May 2011 12:55:47 +0200
Thanks Robert.

D

On 24 May 2011, at 12:40, Robert Purves wrote:

>
> Dan Baeckström wrote:
>
>> I have previously been shown here how values can be returned from  
>> local fns using pointers to variables
>>
>> local fn sillydemo(a as short, b as ^short,c as ^double)
>> b.0% = 2*a
>> c.0# = pi*a
>> end fn
>>
>> dim as short x
>> dim as double y
>> fn sillydemo(3,@x,@y)
>> print x,y
>>
>> My next question is: how is the corresponding thing achieved when I  
>> want the fn to return an FSRef?
>
>
>
> '--------------------
> include "Util_FileDirectory.incl"
>
> local fn Foo( f as ^FSRef )
> '~'1
> fn FD_ApplicationDirectoryGetFSRef( #f )
> // '#' above means pass the value of f, not its address; f is  
> already a pointer
> end fn
>
>
> dim as FSRef    ref
> fn Foo( @ref )
> // '@' above means 'pass the address of ref'.
> // It is not actually needed in this case, because FBtoC
> // automatically supplies it when the variable is a record.
>
> '...do something with ref...
> '---------------------
>
> Robert P.
>
>
> --
> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
> To access the list archives, go to:  http://freegroups.net/groups/futurebasic/
>