Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does ADir() always create an array?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01187382
Message ID:
01187712
Views:
19
If FoxPro does not find any files that meet the skeleton pattern, then no array is created. Array can not have zero number of elements.

>ADIR() Says in the below code that the variable used as a parameter is not an array. But, according to what VFP's own HELP file says, it should create the array if it does not yet exist.
>
>"Parameters
>"ArrayName
>"Specifies the name of the array. If the array you include doesn't exist, Visual FoxPro automatically creates the array. If the array exists and isn't large enough to contain all the information, Visual FoxPro automatically increases the size of the array to accommodate the information. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and ADIR( ) returns 0 because no matching files are found, the array remains unchanged. If the array doesn't exist and ADIR( ) returns 0, the array isn't created."
>
>
>   nNumberOfPATFiles=ADIR(aPatFiles, "*.PAT")
>
>
>The error message specifically states that "aPatFiles" is not an array. Now, nNumberOfFiles returned 439 files, so it doesn't fit the scenario of returning a 0 value.
>
>Am I missing something here?
>
>Okay, so I set up the variable, aPatientFiles, as an array first, then used the above command as follows, which worked just fine:
>
>
>   DECLARE aPatientFiles[1]
>   nNumberOfPATFiles=ADIR(aPatientFiles, "*.PAT")
>
>
>Isn't this contrary to what the FoxPro HELP file says? It said that if the array didn't exist, FoxPro would create the array, so why didn't it create the array in the first code example without having to DECLARE it as an array?
Greg Reichert
Previous
Reply
Map
View

Click here to load this message in the networking platform