Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP Tip for Today
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
VFP Tip for Today
Divers
Thread ID:
00238302
Message ID:
00238302
Vues:
66
You learn something new every day, or I did at least.

While working on a function to return an array of values, I noticed a feature I was never aware of until now. I was playing with redefining a variable from character to an array in case a character was passed to a UDF instead of an array. For example:
laFiles = ""   && a character value instead of an array
** next, retrieve all the folders in C:\Windows
lnRetVal = GetFolders(@laFiles, "C:\Windows")
My UDF, GetFolders, redefines laFiles as an array and populates it with all the C:\Windows subfolders.

When I was through, laFiles was a 16x5 array. Then I typed laFiles = "" in the command window. Instead of laFiles being an empty character variable, all the array elements were initialized to a blank character field.

So, instead of leaving all array elements defaulting to a logical false or looping through the entire array to initialize all elements, you can initialize all elements to the same value with 1 command.

I am using VFP 6 SP3, so I would be interested to know if prior versions did this and I am just late in catching on to this.
Mark McCasland
Midlothian, TX USA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform