Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing and returning arrays
Message
From
16/03/2002 04:48:23
 
 
To
15/03/2002 15:18:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00633588
Message ID:
00633711
Views:
29
>Is there any way to pass an array from a program to a function, then have the >function to update the array and pass it back to the original calling program?

Hi there,
You can pass array as refference as Jim said,
but I want to point out one very comfortable way of dealing
with this kind of problems - Using objects as data carriers (parameters)

Here is how the story goes :

define class Carrier as custom
declare cow(100,2)
declare cat(100,2)
flag1=.t.
flag2=.f.
enddefine

*Now you can play with this as you are pleased

oCarrier=createobject('Carrier')
oCarrier=myfun(oCarrier)
wait window oCarrier.cat(15,5) + oCarrier.cow(100,1)

Function myfun
lParameters oCarrier
oCarrier.cat(15,5)='FOX '
oCarrier.cow(100,1)='IS GREAT'
oCarrier.flag1=.t.
*
*
return oCarrier


As you can see, you can pass whole cow :-))
to your functions/procedures/methods - nice & easy.

Hope this will ease your parsing pains
Rgds++
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Reply
Map
View

Click here to load this message in the networking platform