Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Save all vars. and everything
Message
De
15/07/2006 15:12:48
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
15/07/2006 01:57:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01136273
Message ID:
01136703
Vues:
10
>>If Mark's idea was to dump variables into a text file of some sort just for debugging purposes, then List Status is the way. Save/Restore is just plain dirty IMO, and very risky. It may have unexpected effects.
>
>I agree with your points (especially the prefixing stuff). But it is also astonishingly fast if you have complex array structures in need of persistence - it is also an arrow to keep in mind for interprocess communication if large amounts of data need to be exchanged. "Dirty" is not always bad (and never if WE do it <bg>).

Just today I've found a bit of code where I had a bunch of g_* prefixed variables (in my old DOS code that I'm converting) in a .mem file, and it read them from the file, saved again into a memo in a temp cursor, then stuffed them in name-type-value triplets into an array:
rest from g_var
save to memo mm
n=occu('G_',mm)
dime var(n,3)
set text on
for u=1 to n
	gdev=at('G_',mm,u)
	gcut=subs(mm,gdev,16)
	gname=left(gcut,at(chr(0),gcut)-1)
	gtype=subs(gcut,12,1)
	var(u,1)=Proper(gname)
    var(u,2)= gtype
	var(u,3)=eval(gname)
endf
Then I used this array to generate a .prg which'd have all these variables set as globals. But that's pretty much the only place where I used the Save command.

I agree, if you know the dangers and know how to apply proper limits, Save/Restore may be the tool of choice for some situations.

To Tore: see, it's not encrypted, just somewhat binary :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform