ADIR() Works Differently in 3.0 than in 2.6

Last reviewed: May 31, 1996
Article ID: Q151752
The information in this article applies to:
  • Professional Edition of Microsoft Visual FoxPro for Macintosh, version 3.0

SUMMARY

The ADIR() function in Visual FoxPro for Macintosh version 3.0 has been changed to work more as it does in Visual FoxPro for Windows when no file skeleton is included as the second argument. In FoxPro for Macintosh version 2.6a, if no file skeleton was used and a folder was specified in the second argument, ADIR() would return the number of files in that folder. In FoxPro for Windows version 2.6x and in Visual FoxPro (Windows and Macintosh), a zero is returned.

MORE INFORMATION

The following commands typed in the FoxPro Command window will illustrate the change in behavior. For these commands, it is assumed that the Visual FoxPro samples folders are installed. If using these commands in FoxPro 2.6, substitute the hard drive name or drive letter and folder or directory path to where Visual FoxPro is installed for the HOME() function. For instance "Macintosh HD:Microsoft Visual FoxPro:" on the Macintosh or "C:\VFP\" in Windows.

    DIMENSION farray(1,1)
    SET DEFAULT TO HOME()+"Samples"
    ? ADIR("farray",":Data:")       && If using VFP/Mac
    ? ADIR("farray","Data\")        && If using VFP/Win

In Visual FoxPro and FoxPro for Windows 2.6, the ADIR() functions above will return a zero. In FoxPro for Macintosh 2.6, they will return a 14, which is the number of files in the Samples:Data folder.

To have ADIR() return the number of files in the Samples:Data folder in Visual FoxPro, use the following syntax for ADIR():

    ? ADIR("farray",":Data:*.*")    && If using VFP/Mac
    ? ADIR("farray","Data\*.*")     && If using VFP/Win


Additional reference words: 3.00 VFoxMac
KBCategory: kbprg kbhowto
KBSubcategory: FxprgGeneral



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 31, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.