Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Acopy function
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00381952
Message ID:
00382040
Vues:
19
Jon,
VFP (and earlier FP versions) will initialize a new array if the second array (your laarray2) doesn't exist. It treats a single-element array as if it were just initialized, but if the array exists and is larger than a single element VFP assumes you want to overwrite it element by element with the first array. Then you get into the problems you saw with subscripts. The solutions are to a) release the array variable, b) redimension it as a single element array or c) redimension it with the same size/structure as the first array.

HTH
Barbara

>When I try this:
>
>dimension laarray(9)
>dimension laarray2(3)
>
>acopy(laarray,larray2)
>
>it fails with the error: subscript is outside defined range.
>I ASSUMED this was because laarray has more elements than laarray2 and VFP wasnt resizing laarray2 to compensate for the additional elements.
>
>However, I try this:
>
>dimension laarray(9)
>dimension laarray2(1)
>
>acopy(laarray,larray2)
>
>and now the two arrays are identical. VFP increased the size of laarray2 to accomodate for the additional elements.
>
>Anyone know why this is??
>
>Jon
Barbara Paltiel, Paltiel Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform