Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing and returning arrays
Message
De
16/03/2002 04:48:23
 
 
À
15/03/2002 15:18:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00633588
Message ID:
00633711
Vues:
30
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform